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_dataset_cosmosdb_mongoapi #28185

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

gerrytan
Copy link
Contributor

@gerrytan gerrytan commented Dec 5, 2024

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

Adds a new resource for Data Factory CosmosDB MongoDB dataset. The resource is modelled similar to data_factory_dataset_cosmosdb_sqlapi

Resource relationship:

azurerm_data_factory --> azurerm_data_factory_linked_service_cosmosdb_mongoapi --> azurerm_data_factory_dataset_cosmosdb_mongoapi

Resource screenshot in portal:

image

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

acctest log: acctests_TestAccDataFactoryDatasetCosmosDbMongoDb_7358021176_20241205-1121+1100.log

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Closes #27106

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

Copy link
Collaborator

@magodo magodo 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 this PR!
I've taken a look through and left some comments inline, but this is mostly looking good to me 👍

- Reorder schema properties
- Change AdditionalProperties model type to map[string]string
- Change Parameters to map[string]string
- Use existing utils.FlattenStringSlice instead of creating a new function
- acctest: update: add 1 more step to update back to basic
- terrafmt fix for acctest and docs
@magodo
Copy link
Collaborator

magodo commented Dec 9, 2024

LGTM! Thank you @gerrytan!

@gerrytan
Copy link
Contributor Author

gerrytan commented Dec 9, 2024

@magodo
Copy link
Collaborator

magodo commented Dec 9, 2024

{EA6F4C5D-DF40-43C0-9EB1-F1381BCD064C}

Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

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

Hi @gerrytan - Few questions and observations below, the key one is the choice of SDK for this new resource. We should prefer go-azure-sdk over kermit unless there's a compelling technical reason as we are attempting to discontinue the use of kermit entirely.
If you can take a look I'll continue review. Thanks!


* `folder` - (Optional) The folder that this Dataset is in. If not specified, the Dataset will appear at the root level.

* `parameters` - (Optional) A map of parameters to associate with the Data Factory Dataset.
Copy link
Member

Choose a reason for hiding this comment

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

Are these exclusively strings? Are there no defined keys for these parameters? If only string values are supported here for technical reasons, it should be called out as a note?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added additional info that only string -> string is supported. I decided not to support other parameter type to maintain consistency with the other _dataset_ resources in the folder.

d95a18f

@@ -0,0 +1,339 @@
package datafactory
Copy link
Member

Choose a reason for hiding this comment

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

This filename seems so be mismatched from the resource name? Should it be data_factory_dataset_cosmosdb_mongodb_resource.go, or should the resource model be named DataFactoryDatasetCosmosDbMongoAPIResource instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, have fixed this into _mondodbapi_resource and corresponding go model type.

d95a18f

"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
"github.com/hashicorp/terraform-provider-azurerm/utils"
"github.com/jackofallops/kermit/sdk/datafactory/2018-06-01/datafactory"
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we're using kermit here rather than go-azure-sdk? It appears supported. We should be avoiding any new usages of Kermit as we are attempting to deprecate and remove this workaround SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have switched to go-azure-sdk in d95a18f. There are tons of other resources in this folder still using kermit though, I've decided they're out of scope of this PR.


---

* `additional_properties` - (Optional) A map of additional properties to associate with the Data Factory Dataset.
Copy link
Member

Choose a reason for hiding this comment

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

As per parameters, can we make this a little more clear as to what is expected here, and what is supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added more info to the doc in d95a18f

- Switch to go-azure-sdk
- Add nil checks, remove additional_properties from acctest
- Document the limited support of string parameters
- Renamed resource go type to be consistent with file name
@gerrytan
Copy link
Contributor Author

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.

Cosmos DB MongoDB-API Data Factory dataset
4 participants