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

Synthetic Monitoring Probe and Check Resources and Data Sources #228

Merged
merged 12 commits into from
Jun 25, 2021

Conversation

trotttrotttrott
Copy link
Member

Adds resources:

  • grafana_synthetic_monitoring_probe
  • grafana_synthetic_monitoring_check

Add data sources:

  • grafana_synthetic_monitoring_probe (single probe by name)
  • grafana_synthetic_monitoring_probes (map of all probes)

Testing

A "cloud" build tag was added to the top of the Synthetic Monitoring _test.go files (// +build cloud). Therefore, CI in its current state will not run them. I've created an issue to capture the effort of enabling CI for these tests as a followup: #226.

Documentation

Documentation was generated with go generate. The resources have custom templates to allow the inclusion of multiple examples. I've created another issue to followup to use subcategories to group cloud resources together in navigation: #227.

adapters.go

The addition of this file was inspired by https://github.com/paultyng/terraform-provider-unifi/blob/8601203944690676671871390d938ed5238a7f08/internal/provider/strings.go. It's a collection of functions for converting types. These should be useful for making resources and data sources more succinct.

schema.go

This was inspired by https://github.com/hashicorp/terraform-provider-google/blob/eb82ee95846c03976d7df3fbbb965f0ea8106d2b/google/datasource_helpers.go. These functions allow us to reuse resource schemas for data sources. This is instead of duplicating them. It's intended for general schema utilities like this that we can use throughout the provider.

Closes #198

Copy link
Contributor

@inkel inkel left a comment

Choose a reason for hiding this comment

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

LGTM! One thing though: examples/resources/grafana_synthetic_monitoring_probe/basic.tf and examples/resources/grafana_synthetic_monitoring_probe/complex.tf look very similar, and neither actually looks complex. Is this because we require to have both?

@captncraig
Copy link
Contributor

captncraig commented Jun 24, 2021

Would it be possible to have the probe resource return the api token for the probe on creation? That would let us store it in vault or anywhere else to automatically provision the probe end-to-end. I realize that may be hard to do on subsequent reads, but maybe it doesn't need to?

simple.tf and complex.tf didn't make sense because they are essentially
the same. Instead resource.tf and resource_update.tf since the reason
there is two is to check that update works properly. The template is
also deleted in favor of the tfplugindocs default which will render
resource.tf automatically.
@trotttrotttrott
Copy link
Member Author

Merging blocked due to tests failing. #231 should resolve this.

Copy link
Contributor

@inkel inkel left a comment

Choose a reason for hiding this comment

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

Thanks for renaming those tests. Changes LGTM, and #231 is approved, so it's only missing a rebase and it should be good to merge.

@trotttrotttrott trotttrotttrott merged commit c1faf36 into master Jun 25, 2021
@trotttrotttrott trotttrotttrott deleted the ttt/synthetic-monitoring branch June 25, 2021 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Synthetic monitoring resource
3 participants