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

azurerm_monitor_data_collection_rule - correctly support streams #18966

Merged
merged 7 commits into from
Oct 27, 2022

Conversation

teowa
Copy link
Contributor

@teowa teowa commented Oct 25, 2022

resolves #18481

relaterd to Azure/azure-rest-api-specs#21200, lots of possible streams values are shown in response.

confirmed with service team that new streams are added on a weekly basis. So here we change the validation func to simply StringIsNotEmpty .

make acctests SERVICE="monitor" TESTARGS="-parallel 10 -test.run=TestAccMonitorDataCollectionRule_" TESTTIMEOUT='1440m'
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/monitor -parallel 10 -test.run=TestAccMonitorDataCollectionRule_ -timeout 1440m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccMonitorDataCollectionRule_basic
=== PAUSE TestAccMonitorDataCollectionRule_basic
=== RUN   TestAccMonitorDataCollectionRule_requiresImport
=== PAUSE TestAccMonitorDataCollectionRule_requiresImport
=== RUN   TestAccMonitorDataCollectionRule_update
=== PAUSE TestAccMonitorDataCollectionRule_update
=== RUN   TestAccMonitorDataCollectionRule_complete
=== PAUSE TestAccMonitorDataCollectionRule_complete
=== CONT  TestAccMonitorDataCollectionRule_basic
=== CONT  TestAccMonitorDataCollectionRule_update
=== CONT  TestAccMonitorDataCollectionRule_requiresImport
=== CONT  TestAccMonitorDataCollectionRule_complete
--- PASS: TestAccMonitorDataCollectionRule_basic (192.65s)
--- PASS: TestAccMonitorDataCollectionRule_requiresImport (208.63s)
--- PASS: TestAccMonitorDataCollectionRule_complete (234.82s)
--- PASS: TestAccMonitorDataCollectionRule_update (545.41s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor       545.444s

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

test failure:

Test ended in panic.

------- Stdout: -------
=== RUN   TestAccMonitorDataCollectionRuleDataSource_complete
=== PAUSE TestAccMonitorDataCollectionRuleDataSource_complete
=== CONT  TestAccMonitorDataCollectionRuleDataSource_complete

------- Stderr: -------
panic: Invalid address to set: []string{"data_sources", "0", "syslog", "0", "streams"}

goroutine 613 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc0006c7f80, {0x579bdc6, 0xc}, {0x5962320, 0xc001a0e900})
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:230 +0x291
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.ResourceMetaData.Encode({0xc001f92000, {0x6d77a70, 0xc003570690}, 0xc0006c7f80, 0x0, {0x6d79520, 0xb00ee48}}, {0x5919080?, 0xc001c9a6e0})
	/opt/teamcity-agent/work/5e6516bb4d10eb66/internal/sdk/resource_encode.go:27 +0x396
github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor.DataCollectionRuleDataSource.Read.func1({0x6d76490, 0xc001d8a5a0}, {0xc001f92000, {0x6d77a70, 0xc003570690}, 0xc0006c7f80, 0x0, {0x6d79520, 0xb00ee48}})
	/opt/teamcity-agent/work/5e6516bb4d10eb66/internal/services/monitor/monitor_data_collection_rule_data_source.go:289 +0x9f1
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.(*DataSourceWrapper).DataSource.func2({0x6d76490, 0xc001d8a5a0}, 0x1176592d408?, {0x5b3c100?, 0xc001f92000?})
	/opt/teamcity-agent/work/5e6516bb4d10eb66/internal/sdk/wrapper_data_source.go:48 +0x158
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.diagnosticsWrapper.func1({0x6d76490, 0xc001d8a5a0}, 0x7f7beaedaf18?, {0x5b3c100, 0xc001f92000})
	/opt/teamcity-agent/work/5e6516bb4d10eb66/internal/sdk/wrapper_resource.go:185 +0xbe
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0035ea0e0, {0x6d764c8, 0xc001d94540}, 0xd?, {0x5b3c100, 0xc001f92000})
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:724 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc0035ea0e0, {0x6d764c8, 0xc001d94540}, 0xc0006c7e80, {0x5b3c100, 0xc001f92000})
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:943 +0x145
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc00000f1b8, {0x6d764c8?, 0xc001d944e0?}, 0xc001d96200)
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go:1179 +0x38f
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0xc0022df860, {0x6d764c8?, 0xc001ce1dd0?}, 0xc00027df90)
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go:658 +0x3ef
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x6183cc0?, 0xc0022df860}, {0x6d764c8, 0xc001ce1dd0}, 0xc001d8a120, 0x0)
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:421 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc003526000, {0x6d88768, 0xc0038821a0}, 0xc001d90000, 0xc00227d470, 0xafcd430, 0x0)
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/google.golang.org/grpc/server.go:1283 +0xcfd
google.golang.org/grpc.(*Server).handleStream(0xc003526000, {0x6d88768, 0xc0038821a0}, 0xc001d90000, 0x0)
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/google.golang.org/grpc/server.go:1620 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/google.golang.org/grpc/server.go:922 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/opt/teamcity-agent/work/5e6516bb4d10eb66/vendor/google.golang.org/grpc/server.go:920 +0x28a`

@teowa
Copy link
Contributor Author

teowa commented Oct 27, 2022

make acctests SERVICE="monitor" TESTARGS="-parallel 20 -test.run=TestAccMonitorDataCollectionRule" TESTTIMEOUT='1440m'
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/monitor -parallel 20 -test.run=TestAccMonitorDataCollectionRule -timeout 1440m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccMonitorDataCollectionRuleAssociation_basic
=== PAUSE TestAccMonitorDataCollectionRuleAssociation_basic
=== RUN   TestAccMonitorDataCollectionRuleAssociation_basicEndpoint
=== PAUSE TestAccMonitorDataCollectionRuleAssociation_basicEndpoint
=== RUN   TestAccMonitorDataCollectionRuleAssociation_requiresImport
=== PAUSE TestAccMonitorDataCollectionRuleAssociation_requiresImport
=== RUN   TestAccMonitorDataCollectionRuleAssociation_update
=== PAUSE TestAccMonitorDataCollectionRuleAssociation_update
=== RUN   TestAccMonitorDataCollectionRuleAssociation_updateDataCollectionRuleId
=== PAUSE TestAccMonitorDataCollectionRuleAssociation_updateDataCollectionRuleId
=== RUN   TestAccMonitorDataCollectionRuleAssociation_complete
=== PAUSE TestAccMonitorDataCollectionRuleAssociation_complete
=== RUN   TestAccMonitorDataCollectionRuleDataSource_complete
=== PAUSE TestAccMonitorDataCollectionRuleDataSource_complete
=== RUN   TestAccMonitorDataCollectionRule_basic
=== PAUSE TestAccMonitorDataCollectionRule_basic
=== RUN   TestAccMonitorDataCollectionRule_requiresImport
=== PAUSE TestAccMonitorDataCollectionRule_requiresImport
=== RUN   TestAccMonitorDataCollectionRule_update
=== PAUSE TestAccMonitorDataCollectionRule_update
=== RUN   TestAccMonitorDataCollectionRule_complete
=== PAUSE TestAccMonitorDataCollectionRule_complete
=== CONT  TestAccMonitorDataCollectionRuleAssociation_basic
=== CONT  TestAccMonitorDataCollectionRuleDataSource_complete
=== CONT  TestAccMonitorDataCollectionRuleAssociation_update
=== CONT  TestAccMonitorDataCollectionRuleAssociation_complete
=== CONT  TestAccMonitorDataCollectionRuleAssociation_updateDataCollectionRuleId
=== CONT  TestAccMonitorDataCollectionRule_update
=== CONT  TestAccMonitorDataCollectionRule_requiresImport
=== CONT  TestAccMonitorDataCollectionRule_complete
=== CONT  TestAccMonitorDataCollectionRuleAssociation_requiresImport
=== CONT  TestAccMonitorDataCollectionRuleAssociation_basicEndpoint
=== CONT  TestAccMonitorDataCollectionRule_basic
--- PASS: TestAccMonitorDataCollectionRule_basic (183.70s)
--- PASS: TestAccMonitorDataCollectionRule_requiresImport (214.31s)
--- PASS: TestAccMonitorDataCollectionRuleDataSource_complete (224.66s)
--- PASS: TestAccMonitorDataCollectionRule_complete (234.82s)
--- PASS: TestAccMonitorDataCollectionRuleAssociation_basic (360.32s)
--- PASS: TestAccMonitorDataCollectionRuleAssociation_requiresImport (381.71s)
--- PASS: TestAccMonitorDataCollectionRule_update (402.85s)
--- PASS: TestAccMonitorDataCollectionRuleAssociation_basicEndpoint (411.96s)
--- PASS: TestAccMonitorDataCollectionRuleAssociation_complete (418.98s)
--- PASS: TestAccMonitorDataCollectionRuleAssociation_update (438.00s)
--- PASS: TestAccMonitorDataCollectionRuleAssociation_updateDataCollectionRuleId (450.93s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor       450.982s

@teowa teowa requested a review from katbyte October 27, 2022 03:30
@katbyte katbyte changed the title azurerm_monitor_data_collection_rule - fix data collection rule streams azurerm_monitor_data_collection_rule - support streams Oct 27, 2022
@katbyte katbyte changed the title azurerm_monitor_data_collection_rule - support streams azurerm_monitor_data_collection_rule - correctly support streams Oct 27, 2022
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

LGTM 💧

@katbyte katbyte merged commit 6e461b7 into hashicorp:main Oct 27, 2022
katbyte added a commit that referenced this pull request Oct 27, 2022
@github-actions github-actions bot added this to the v3.29.0 milestone Oct 27, 2022
@github-actions
Copy link

This functionality has been released in v3.29.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data Rule Collection Extension DependencyAgent not working
2 participants