-
Notifications
You must be signed in to change notification settings - Fork 57
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
SUMO-248024: #691
SUMO-248024: #691
Conversation
…_destination, and adjusted default values
…d updated the corresponding documentation
…warding_rule and data_forwarding_destination and added example to correctly configure the data forwarding rule for a scheduled view
fdf9bc4
to
78a8578
Compare
@@ -62,7 +62,7 @@ func (s *Client) DeleteDataForwardingRule(indexId string) error { | |||
type DataForwardingRule struct { | |||
IndexId string `json:"indexId"` | |||
DestinationId string `json:"destinationId"` | |||
Enabled bool `json:"enabled,omitempty"` | |||
Enabled bool `json:"enabled"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we making this change? This will send value as false
instead of not serialising it in json response(which eventually gets treated as null
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bad part is that enabled = false
is treated as null.... and whenever we are trying to set false
, it is not sent in the API call...
We are not setting any default for enabled
.. so it will not be send as false
in case left blank (see here).
I've tested this scenario..
resource "sumologic_data_forwarding_rule" "test_rule_sv" { | ||
index_id = sumologic_scheduled_view.failed_connections.index_id | ||
destination_id = sumologic_data_forwarding_destination.test_destination.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when user supplies both IndexName
and IndexId
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IndexId
will simply be ignored ... as IndexId
is never taken into consideration in PUT/POST calls .. please check the API documentation here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are just using IndexId
for creating the DF Rule... it is never updated in the PUT call, nor it is ever required to maintain the SV resource's state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IndexId will simply be ignored .
This behavior should be documented in the terraform docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we are documenting it in the SV page itself as it belongs to SV.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the docs in the latest commit.
- `destination_id` - (Required) The data forwarding destination id. | ||
- `enabled` - (Required) True when the data forwarding rule is enabled. | ||
- `enabled` - (Optional) True when the data forwarding rule is enabled. Will be treated as _false_ if left blank. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add possible values for file_format
here to aid customers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed, we already have a descriptive documentation ... and that is added on top of this page - see here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
I disagree, we should cover the possible values here. Can't rely on an example to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I update this Rule's TF documentation and add a pointer to the original documentation here (point 6) in that case?
Possible values for file_format
are a combination of few placeholders, and adding all of them here will not look good in the TF docs imho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the docs in the latest commit.
CHANGELOG.md
Outdated
@@ -2,6 +2,11 @@ | |||
DEPRECATIONS: | |||
* resource_sumologic_ingest_budget : Deprecated in favour of `resource_sumologic_ingest_budget_v2`. | |||
|
|||
## 2.31.5 (September 23, 2024) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove date. Date shall be added on the day of release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
70b1648
to
d33dd93
Compare
@@ -2,6 +2,11 @@ | |||
DEPRECATIONS: | |||
* resource_sumologic_ingest_budget : Deprecated in favour of `resource_sumologic_ingest_budget_v2`. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a little strange to be doing a 2.x release while having the 3.0.0
section in the CHANGELOG, with content in it already. But I think it's ok.
(Also, an (Unreleased)
on the 2.31.5
line would be appropriate, but there's no need to change it; one of us will be editing that line with the correct date anyway.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh, I thought that 3.0.0 is written for some other purpose.. and didn't thought of using that, just continued after 2.31.3 ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dagould are you planning to maintain two versions of the provider? I would be in favor of just continuing 3.x.x
version.
@@ -33,12 +33,10 @@ func resourceSumologicDataForwardingRule() *schema.Resource { | |||
"enabled": { | |||
Type: schema.TypeBool, | |||
Optional: true, | |||
Default: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a change in behavior. A rule will be disabled by default now? This might be a breaking change. The good part is we are scheduled for a major release if this is a breaking change it should be fine. We should document the new behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -23,6 +23,7 @@ QUERY | |||
retention_period = 365 | |||
lifecycle { | |||
prevent_destroy = true | |||
ignore_changes = [index_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a comment here explaining why we need to add index_id
to ignore_changes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added in this same doc a little below at line 48.
@@ -44,6 +45,7 @@ The following arguments are supported: | |||
The following attributes are exported: | |||
|
|||
- `id` - The internal ID of the scheduled view. | |||
- `index_id` - The Index ID of the scheduled view. It never updates at any point of time during resource updates, therefore make sure to ignore this via `ignore_changes = [index_id]`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a gap in the API. index_id
is a write-only field and it never updates after the initial creation. This behavior should have been enforced in the API rather than relying on users to not update index_id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the user passes index_id
, it will simply be ignored at the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the user passes index_id, it will simply be ignored at the API.
I don't think this is right behavior. We are silently dropping a field provided by the client. Instead we should return error b/c request is invalid as you are not allowed to change the index id. This is the real issue here.
It should be noted that ignore_changes
is not strictly required if you don't change the index id which I believe most customer won't do, given we don't support it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be noted that ignore_changes is not strictly required if you don't change the index id which I believe most customer won't do, given we don't support it?
Yes, not a strict requirement to add ignore_changes
.. but recommended, and hence conveying that msg in the documentation here.
I don't think this is right behavior. We are silently dropping a field provided by the client. Instead we should return error b/c request is invalid as you are not allowed to change the index id. This is the real issue here.
- This will not even reach the API layer as it'll be dropped by OpenAPI translation itself and will not be translated into the request payload's Java Object.
- Moreover, there can be some invalid fields added by the user (by mistake or intentionally), so those are also simply ignored and not translated by OpenAPI...
- Therefore, we can't really do much with this
index_id
field being ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not even reach the API layer as it'll be dropped by OpenAPI translation itself and will not translated into the request payload's Java Object.
We can follow-up internally on this one. I don't see a reason why OpenAPI would silently drop a field.
Yes, not a strict requirement to add ignore_changes .. but recommended, and hence conveying that msg in the documentation here.
The language should be updated to reflect that. Currently, it seems we are asking to add ignore_changes
rather than a recommendation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can follow-up internally on this one. I don't see a reason why OpenAPI would silently drop a field.
Sure, can I know the set of people who can help me here?
Also, is it a blocker for this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The language should be updated to reflect that. Currently, it seems we are asking to add ignore_changes rather than a recommendation.
But without ignore_changes
, we are running into this issue.. let's continue for this on the slack thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But without ignore_changes, we are running into this issue.. let's continue for this on the slack thread.
Issue is resolved with the introduction of computed prop for index_id
. (see thread)
I'm updating the documentation that ignore_changes
is just a recommendation and not a mandatory thing.
…mentations as per the review comments.
@@ -44,6 +45,7 @@ The following arguments are supported: | |||
The following attributes are exported: | |||
|
|||
- `id` - The internal ID of the scheduled view. | |||
- `index_id` - The Index ID of the scheduled view. It remains unchanged during resource updates, and any manual modifications will be disregarded. While it’s not mandatory, we recommend to ignore this via `ignore_changes = [index_id]`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we have made this field as computed you can drop the "modification" and ignore_changes part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I have just kept if for the fact that if someone explicitly tries to set index_id = "000000ABCDE..." (some random value)
in the resource definition, then with the help of ignore_changes
that will be ignored.
retention_period = 1 | ||
lifecycle { | ||
prevent_destroy = true | ||
ignore_changes = [index_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not needed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I have just kept if for the fact that if someone explicitly tries to set index_id = "000000ABCDE..." (some random value)
in the resource definition, then with the help of ignore_changes
that will be ignored.
What are we doing?
enabled
to the documentation of sumologic_data_forwarding_destination, and adjusted default values.index_id
in sumologic_scheduled_views, and adjusted necessary documentations.Why is this required?
As a part of supporting Data Forwarding Rules creation via TF for Scheduled Views we need
index_id
, because theid
is coming from the autoview table.Please review commit by commit.
Testing
Manual testing has been performed via
main.tf
and we are successfully able to configure a DF Rule for a SV. Attached test results and the test file in the comment.