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

New Resource: azurerm_data_factory_linked_service_odata #11556

Merged
merged 13 commits into from
Jun 16, 2021

Conversation

pomverte
Copy link
Contributor

@pomverte pomverte commented May 2, 2021

Add support for Terraform configuration for Azure Data Factory Linked Service of type OData.

New resource azurerm_data_factory_linked_service_odata

resource "azurerm_data_factory_linked_service_odata" "example" {
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name
  data_factory_name   = azurerm_data_factory.example.name
  url                 = "https://services.odata.org/v4/TripPinServiceRW/People"
}

Documentation : https://docs.microsoft.com/en-us/azure/data-factory/connector-odata

First try: #7704

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.

Thanks @pomverte - In addtion to the comments i've left inline, the tests are failing with:

Test ended in panic.

------- Stdout: -------
=== RUN   TestAccDataFactoryLinkedServiceOData_anon_auth
=== PAUSE TestAccDataFactoryLinkedServiceOData_anon_auth
=== CONT  TestAccDataFactoryLinkedServiceOData_anon_auth

------- Stderr: -------
2021/05/03 19:31:10 [DEBUG] not using binary driver name, it's no longer needed
2021/05/03 19:31:10 [DEBUG] not using binary driver name, it's no longer needed
panic: runtime error: index out of range [0] with length 0

goroutine 469 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory.authenticationProperties(0xc0036e39d0, 0x5e6aa60)
	/opt/teamcity-agent/work/a73be106926a7472/azurerm/internal/services/datafactory/data_factory_linked_service_odata_resource.go:249 +0x485
github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory.resourceArmDataFactoryLinkedServiceODataCreateUpdate(0xc0036e39d0, 0x5656440, 0xc00118a000, 0x0, 0x0)
	/opt/teamcity-agent/work/a73be106926a7472/azurerm/internal/services/datafactory/data_factory_linked_service_odata_resource.go:151 +0x22b
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc001845860, 0xc001d43860, 0xc0016a4940, 0x5656440, 0xc00118a000, 0x5685a01, 0xc00327d7c8, 0xc001a5c1e0)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:320 +0x375
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc0030cd200, 0xc000e6fa38, 0xc001d43860, 0xc0016a4940, 0xc001a5a088, 0xc0032d9f90, 0x5688ce0)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:294 +0x99
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc0019216f8, 0x65f27f0, 0xc001a52ba0, 0xc0036e3260, 0xc0019216f8, 0xc001a52ba0, 0xc001b00ba0)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:895 +0x8a5
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x5b6a4a0, 0xc0019216f8, 0x65f27f0, 0xc001a52ba0, 0xc002400f60, 0x0, 0x65f27f0, 0xc001a52ba0, 0xc001a56700, 0x359)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3305 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00127f6c0, 0x6639398, 0xc003058900, 0xc001250f00, 0xc001ccbc50, 0x9a5e6e0, 0x0, 0x0, 0x0)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/google.golang.org/grpc/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc00127f6c0, 0x6639398, 0xc003058900, 0xc001250f00, 0x0)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/google.golang.org/grpc/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000d5c130, 0xc00127f6c0, 0x6639398, 0xc003058900, 0xc001250f00)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/google.golang.org/grpc/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/opt/teamcity-agent/work/a73be106926a7472/vendor/google.golang.org/grpc/server.go:857 +0x1fd

@pomverte pomverte force-pushed the adf-linked-service-odata branch 2 times, most recently from 5127b7b to 2f9efcc Compare May 7, 2021 17:35
@pomverte
Copy link
Contributor Author

pomverte commented May 7, 2021

Thanks @katbyte for the reviews, could you help me to run test for debug ?

Commands ran:

$ az login
$ make acctests datafactory
==> 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 ./azurerm/internal/services/  -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
no Go files in /Users/xxx/go/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services
make: *** [acctests] Error 1

Is there a way to get more logs from the error ?

Thanks @pomverte - In addtion to the comments i've left inline, the tests are failing with:

Test ended in panic.

------- Stdout: -------
=== RUN   TestAccDataFactoryLinkedServiceOData_anon_auth
=== PAUSE TestAccDataFactoryLinkedServiceOData_anon_auth
=== CONT  TestAccDataFactoryLinkedServiceOData_anon_auth

------- Stderr: -------
2021/05/03 19:31:10 [DEBUG] not using binary driver name, it's no longer needed
2021/05/03 19:31:10 [DEBUG] not using binary driver name, it's no longer needed
panic: runtime error: index out of range [0] with length 0

goroutine 469 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory.authenticationProperties(0xc0036e39d0, 0x5e6aa60)
	/opt/teamcity-agent/work/a73be106926a7472/azurerm/internal/services/datafactory/data_factory_linked_service_odata_resource.go:249 +0x485
github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory.resourceArmDataFactoryLinkedServiceODataCreateUpdate(0xc0036e39d0, 0x5656440, 0xc00118a000, 0x0, 0x0)
	/opt/teamcity-agent/work/a73be106926a7472/azurerm/internal/services/datafactory/data_factory_linked_service_odata_resource.go:151 +0x22b
...

@ghost ghost removed the waiting-response label May 7, 2021
}

if v, ok := d.GetOk("parameters"); ok {
odataLinkedService.Parameters = expandDataFactoryParameters(v.(map[string]interface{}))
Copy link
Collaborator

Choose a reason for hiding this comment

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

the crash is here because Parameters is nil because nothings been set yet, you'll need to init it above

@pomverte pomverte force-pushed the adf-linked-service-odata branch from 0b3ee24 to 295b5b1 Compare May 16, 2021 14:58
@pomverte pomverte force-pushed the adf-linked-service-odata branch from 295b5b1 to 4a62bd8 Compare May 17, 2021 11:55
@pomverte pomverte requested a review from katbyte May 17, 2021 14:14
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.

Looks like the tests are failing:

est ended in panic.

------- Stdout: -------
=== RUN   TestAccDataFactoryLinkedServiceOData_basic_update
=== PAUSE TestAccDataFactoryLinkedServiceOData_basic_update
=== CONT  TestAccDataFactoryLinkedServiceOData_basic_update

------- Stderr: -------
2021/05/18 20:43:14 [DEBUG] not using binary driver name, it's no longer needed
2021/05/18 20:43:14 [DEBUG] not using binary driver name, it's no longer needed
panic: runtime error: index out of range [0] with length 0

goroutine 484 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory.authenticationProperties(0xc001b89b20, 0x5f2f76a)
	/opt/teamcity-agent/work/a73be106926a7472/azurerm/internal/services/datafactory/data_factory_linked_service_odata_resource.go:275 +0x425
github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory.resourceArmDataFactoryLinkedServiceODataCreateUpdate(0xc001b89b20, 0x570c9e0, 0xc0002aa300, 0x0, 0x0)
	/opt/teamcity-agent/work/a73be106926a7472/azurerm/internal/services/datafactory/data_factory_linked_service_odata_resource.go:148 +0x27d
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc002942000, 0xc0018f0af0, 0xc000b4cd80, 0x570c9e0, 0xc0002aa300, 0x573c401, 0xc001f12c28, 0xc00242e840)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:320 +0x375
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc003656780, 0xc0013bfa38, 0xc0018f0af0, 0xc000b4cd80, 0xc002c9ebc8, 0xc0021fa3a0, 0x573f640)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:294 +0x99
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc001d268d8, 0x66c84f0, 0xc00216cea0, 0xc001b89500, 0xc001d268d8, 0xc00216cea0, 0xc001909ba0)
	/opt/teamcity-agent/work/a73be106926a7472/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:895 +0x8a5
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x5c28400, 0xc001d268d8, 0x66c84f0, 0xc0

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

LGTM!

I just fixed the crashes and moved some of the logic around so it'll be easier to expand on if we need to enable some more features. Thanks for opening this PR!

@mbfrahry mbfrahry changed the title New Resource: azurerm_data_factory_linked_service_odata New Resource: azurerm_data_factory_linked_service_odata Jun 16, 2021
@mbfrahry mbfrahry merged commit cb587a5 into hashicorp:master Jun 16, 2021
mbfrahry added a commit that referenced this pull request Jun 16, 2021
@katbyte katbyte added this to the v2.64.0 milestone Jun 17, 2021
@github-actions
Copy link

This functionality has been released in v2.64.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 Jul 19, 2021
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.

3 participants