ACLP Logs#2359
Conversation
33d0b4a to
a2f18a1
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds Terraform Framework support for Monitor Logs destinations and streams, including singular resources/data sources, list data sources, stream history lookup, acceptance/unit tests, provider registration, and CI suite wiring.
Changes:
- Adds
linode_monitor_logs_destinationandlinode_monitor_logs_streamresources with schema, CRUD, model flattening, templates, and tests. - Adds singular/list data sources for destinations and streams, plus a stream history data source.
- Registers the new Terraform types and adds their integration suites to the workflow.
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/integration_tests.yml |
Adds monitor logs suites and long-test env propagation. |
linode/framework_provider.go |
Registers new monitor logs resources and data sources. |
linode/monitorlogsdestination/framework_resource.go |
Implements destination resource CRUD. |
linode/monitorlogsdestination/framework_models.go |
Adds destination resource/data source models and flattening. |
linode/monitorlogsdestination/framework_schema_resource.go |
Defines destination resource schema. |
linode/monitorlogsdestination/framework_schema_datasource.go |
Defines singular destination data source schema. |
linode/monitorlogsdestination/framework_datasource.go |
Implements singular destination data source read. |
linode/monitorlogsdestination/framework_models_unit_test.go |
Adds destination model unit tests. |
linode/monitorlogsdestination/resource_test.go |
Adds destination resource acceptance tests. |
linode/monitorlogsdestination/datasource_test.go |
Adds destination data source acceptance tests. |
linode/monitorlogsdestination/tmpl/template.go |
Adds destination test template helpers. |
linode/monitorlogsdestination/tmpl/basic.gotf |
Adds destination basic resource test config. |
linode/monitorlogsdestination/tmpl/updates.gotf |
Adds destination update test config. |
linode/monitorlogsdestination/tmpl/bucket_only.gotf |
Adds bucket-only teardown config. |
linode/monitorlogsdestination/tmpl/data_basic.gotf |
Adds destination data source test config. |
linode/monitorlogsdestination/tmpl/data_not_found.gotf |
Adds destination not-found data source config. |
linode/monitorlogsdestination/tmpl/invalid_type.gotf |
Adds invalid destination type config. |
linode/monitorlogsdestinations/framework_datasource.go |
Implements list destination data source read/filtering. |
linode/monitorlogsdestinations/framework_models.go |
Adds list destination models. |
linode/monitorlogsdestinations/framework_schema_datasource.go |
Defines list destination data source schema/filter config. |
linode/monitorlogsdestinations/datasource_test.go |
Adds list destination data source acceptance test. |
linode/monitorlogsdestinations/tmpl/template.go |
Adds list destination test template helpers. |
linode/monitorlogsdestinations/tmpl/data_basic.gotf |
Adds list destination data source test config. |
linode/monitorlogsdestinations/tmpl/bucket_only.gotf |
Adds bucket-only teardown config. |
linode/monitorlogsstream/framework_resource.go |
Implements stream resource CRUD/import. |
linode/monitorlogsstream/framework_models.go |
Adds stream resource/data source models and options builders. |
linode/monitorlogsstream/framework_schema_resource.go |
Defines stream resource schema. |
linode/monitorlogsstream/framework_schema_datasource.go |
Defines singular stream data source schema. |
linode/monitorlogsstream/framework_datasource.go |
Implements singular stream data source read. |
linode/monitorlogsstream/framework_models_unit_test.go |
Adds stream model unit tests. |
linode/monitorlogsstream/resource_test.go |
Adds long-running stream lifecycle acceptance test and invalid config tests. |
linode/monitorlogsstream/datasource_test.go |
Adds stream data source not-found test. |
linode/monitorlogsstream/tmpl/template.go |
Adds stream test template helpers. |
linode/monitorlogsstream/tmpl/basic.gotf |
Adds stream basic resource test config. |
linode/monitorlogsstream/tmpl/lifecycle.gotf |
Adds stream lifecycle config covering related data sources. |
linode/monitorlogsstream/tmpl/updates.gotf |
Adds stream update config. |
linode/monitorlogsstream/tmpl/data_basic.gotf |
Adds singular stream data source config. |
linode/monitorlogsstream/tmpl/data_not_found.gotf |
Adds stream not-found data source config. |
linode/monitorlogsstream/tmpl/invalid_type.gotf |
Adds invalid stream type config. |
linode/monitorlogsstream/tmpl/invalid_destination.gotf |
Adds invalid destination config. |
linode/monitorlogsstreams/framework_datasource.go |
Implements list stream data source read/filtering. |
linode/monitorlogsstreams/framework_models.go |
Adds list stream models. |
linode/monitorlogsstreams/framework_schema_datasource.go |
Defines list stream data source schema/filter config. |
linode/monitorlogsstreams/datasource_test.go |
Adds skipped list stream data source test placeholder. |
linode/monitorlogsstreams/tmpl/template.go |
Adds list stream data source template helper. |
linode/monitorlogsstreams/tmpl/data_basic.gotf |
Adds list stream data source config. |
linode/monitorlogsstreamhistory/framework_datasource.go |
Implements stream history data source read. |
linode/monitorlogsstreamhistory/framework_models.go |
Adds stream history models and flattening. |
linode/monitorlogsstreamhistory/framework_schema_datasource.go |
Defines stream history data source schema. |
linode/monitorlogsstreamhistory/datasource_test.go |
Adds skipped stream history test placeholder. |
linode/monitorlogsstreamhistory/tmpl/template.go |
Adds stream history template helper. |
linode/monitorlogsstreamhistory/tmpl/data_basic.gotf |
Adds stream history data source config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yec-akamai
left a comment
There was a problem hiding this comment.
Can you add documentations for the new resources and data sources under /docs?
|
added docs #2359 (review) |
b3ca4ad to
4573e30
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: sjerecze <sjerecze@akamai.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
# Conflicts: # linode/framework_provider.go
Signed-off-by: sjerecze <sjerecze@akamai.com>
|
Rebased previous commits to clean up git history a bit and merged newest dev branch. |
Signed-off-by: sjerecze <sjerecze@akamai.com>
| return detailsAttr.GetType().(types.ObjectType).AttrTypes | ||
| } | ||
|
|
||
| func TestFlattenStream_AuditLogs(t *testing.T) { |
There was a problem hiding this comment.
I got error for this test
./framework_models_unit_test.go:310:21: opts.Type undefined (type linodego.StreamUpdateOptions has no field or method Type). Could you verify it please?
| "github.com/linode/terraform-provider-linode/v4/linode/monitorlogsstream/tmpl" | ||
| ) | ||
|
|
||
| func TestAccDataSourceMonitorLogsStream_notFound(t *testing.T) { |
There was a problem hiding this comment.
I got error here
./resource_test.go:124:3: cannot use []string{…} (value of type []string) as []linodego.RegionCapability value in argument to acceptance.GetRandomRegionWithCaps ./resource_test.go:124:12: cannot use linodego.CapabilityObjectStorage (constant "Object Storage" of string type linodego.RegionCapability) as string value in array or slice literal
Signed-off-by: sjerecze <sjerecze@akamai.com>
yec-akamai
left a comment
There was a problem hiding this comment.
Tests are all passing now. Thank you!
|
|
||
| ```terraform | ||
| data "linode_monitor_logs_streams" "all" {} | ||
| ``` |
There was a problem hiding this comment.
If there is empty list of streams, it returns error:
│ Error: Failed to list resources │ │ with data.linode_monitor_logs_destinations.test, │ on config.tf line 13, in data "linode_monitor_logs_destinations" "test": │ 13: data "linode_monitor_logs_destinations" "test" { │ │ [400] [X-Filter.+and] Cannot apply filter
The same output for empty destinations and data "linode_monitor_logs_destinations" "all" {}
There was a problem hiding this comment.
This seems to be an API issue. Applied the same fix already present in listMonitorAlertChannels in repo, moving the filtering from API to terraform. Should work now
…d destinations list. Signed-off-by: sjerecze <sjerecze@akamai.com>
📝 Description
Adds Terraform support for the monitoring log destinations api and streams api.
✔️ How to Test
Unit tests:
Integration tests (package specific):