Skip to content

synthetics icmp and browser monitors support #772

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

Merged
merged 8 commits into from
Sep 18, 2024

Conversation

biscout42
Copy link
Contributor

implelents #610

@biscout42 biscout42 changed the title synthetics icmp and browser mon synthetics icmp and browser monitors support Sep 14, 2024
@biscout42 biscout42 marked this pull request as ready for review September 14, 2024 11:24
@biscout42
Copy link
Contributor Author

Error was from TestAccSpacesDataSource, trying to re-run.

    data_source_test.go:11: Step 1/1 error: Error running post-apply plan: exit status 1
        
        Error: unable to list spaces
        
          with data.elasticstack_kibana_spaces.all_spaces,
          on terraform_plugin_test.tf line 7, in data "elasticstack_kibana_spaces" "all_spaces":
           7: data "elasticstack_kibana_spaces" "all_spaces" {
        
        400 Bad Request
--- FAIL: TestAccSpacesDataSource

stringvalidator.OneOf("on", "off", "only-on-failure"),
},
Computed: true,
Default: stringdefault.StaticString("on"),
Copy link
Member

Choose a reason for hiding this comment

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

From the docs:

If the attribute is computed and the value could be altered by other changes then a default should be avoided and a plan modifier should be used instead.

The same goes for the other Default values in the schema.

I'm not sure if these need to be computed, but if they do we likely want something like:

PlanModifiers: []{stringplanmodifiers.UseStateForUnknown(), defaultModifier("on")}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot, let me check. The issue I had - plan was different after creation, because API returns default value for this attribute, but I didn't set it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I"m sorry, it doesn't work. TF complains

Schema Using
        Attribute Default For Non-Computed Attribute: Attribute "browser.screenshots"
        must be computed when using default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll leave only computed then, as a sign that API defines values, if not set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI: according to hashicorp/terraform-plugin-framework#285 there is no default for plan modifier and UseStateForUnknown should be enough. At least, I wasn't able to find default modifier in plugin framework. Please, let me know if I need to add it and how.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tobio , should be done, could you re-check?

@biscout42 biscout42 requested a review from tobio September 16, 2024 08:44
@biscout42 biscout42 enabled auto-merge (squash) September 16, 2024 12:00
@biscout42
Copy link
Contributor Author

FYI: auto-merge is on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants