diff --git a/internal/services/datafactory/data_factory_linked_service_cosmosdb_mongoapi_resource.go b/internal/services/datafactory/data_factory_linked_service_cosmosdb_mongoapi_resource.go new file mode 100644 index 000000000000..3507ae885afd --- /dev/null +++ b/internal/services/datafactory/data_factory_linked_service_cosmosdb_mongoapi_resource.go @@ -0,0 +1,258 @@ +package datafactory + +import ( + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceDataFactoryLinkedServiceCosmosDbMongoAPI() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceDataFactoryLinkedServiceCosmosDbMongoAPICreateUpdate, + Read: resourceDataFactoryLinkedServiceCosmosDbMongoAPIRead, + Update: resourceDataFactoryLinkedServiceCosmosDbMongoAPICreateUpdate, + Delete: resourceDataFactoryLinkedServiceCosmosDbMongoAPIDelete, + + Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { + _, err := parse.LinkedServiceID(id) + return err + }, importDataFactoryLinkedService(datafactory.TypeBasicLinkedServiceTypeCosmosDbMongoDbAPI)), + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.LinkedServiceDatasetName, + }, + + "data_factory_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DataFactoryName(), + }, + + // There's a bug in the Azure API where this is returned in lower-case + // BUG: https://github.com/Azure/azure-rest-api-specs/issues/5788 + "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), + + "connection_string": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + DiffSuppressFunc: azureRmDataFactoryLinkedServiceConnectionStringDiff, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "database": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "server_version_is_32_or_higher": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "integration_runtime_name": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "parameters": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "annotations": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "additional_properties": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + }, + } +} + +func resourceDataFactoryLinkedServiceCosmosDbMongoAPICreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DataFactory.LinkedServiceClient + subscriptionId := meta.(*clients.Client).DataFactory.LinkedServiceClient.SubscriptionID + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewLinkedServiceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("data_factory_name").(string), d.Get("name").(string)) + + if d.IsNewResource() { + existing, err := client.Get(ctx, id.ResourceGroup, id.FactoryName, id.Name, "") + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for presence of existing Data Factory Linked Service CosmosDb %q (Data Factory %q / Resource Group %q): %+v", id.Name, id.FactoryName, id.ResourceGroup, err) + } + } + + if existing.ID != nil && *existing.ID != "" { + return tf.ImportAsExistsError("azurerm_data_factory_linked_service_cosmosdb", *existing.ID) + } + } + + cosmosdbProperties := &datafactory.CosmosDbMongoDbAPILinkedServiceTypeProperties{} + + connectionStringSecureString := datafactory.SecureString{ + Value: utils.String(d.Get("connection_string").(string)), + Type: datafactory.TypeSecureString, + } + cosmosdbProperties.ConnectionString = connectionStringSecureString + cosmosdbProperties.Database = d.Get("database").(string) + cosmosdbProperties.IsServerVersionAbove32 = d.Get("server_version_is_32_or_higher").(bool) + + cosmosdbLinkedService := &datafactory.CosmosDbMongoDbAPILinkedService{ + Description: utils.String(d.Get("description").(string)), + CosmosDbMongoDbAPILinkedServiceTypeProperties: cosmosdbProperties, + Type: datafactory.TypeBasicLinkedServiceTypeCosmosDbMongoDbAPI, + } + + if v, ok := d.GetOk("parameters"); ok { + cosmosdbLinkedService.Parameters = expandDataFactoryParameters(v.(map[string]interface{})) + } + + if v, ok := d.GetOk("integration_runtime_name"); ok { + cosmosdbLinkedService.ConnectVia = expandDataFactoryLinkedServiceIntegrationRuntime(v.(string)) + } + + if v, ok := d.GetOk("additional_properties"); ok { + cosmosdbLinkedService.AdditionalProperties = v.(map[string]interface{}) + } + + if v, ok := d.GetOk("annotations"); ok { + annotations := v.([]interface{}) + cosmosdbLinkedService.Annotations = &annotations + } + + linkedService := datafactory.LinkedServiceResource{ + Properties: cosmosdbLinkedService, + } + + if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.FactoryName, id.Name, linkedService, ""); err != nil { + return fmt.Errorf("creating/updating Data Factory Linked Service CosmosDb %q (Data Factory %q / Resource Group %q): %+v", id.Name, id.FactoryName, id.ResourceGroup, err) + } + + d.SetId(id.ID()) + + return resourceDataFactoryLinkedServiceCosmosDbMongoAPIRead(d, meta) +} + +func resourceDataFactoryLinkedServiceCosmosDbMongoAPIRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DataFactory.LinkedServiceClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.LinkedServiceID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.FactoryName, id.Name, "") + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + + return fmt.Errorf("retrieving Data Factory Linked Service CosmosDB %q (Data Factory %q / Resource Group %q): %+v", id.Name, id.FactoryName, id.ResourceGroup, err) + } + + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("data_factory_name", id.FactoryName) + + cosmosdb, ok := resp.Properties.AsCosmosDbMongoDbAPILinkedService() + if !ok { + return fmt.Errorf("classifying Data Factory Linked Service CosmosDb %q (Data Factory %q / Resource Group %q): Expected: %q Received: %q", id.Name, id.FactoryName, id.ResourceGroup, datafactory.TypeBasicLinkedServiceTypeCosmosDbMongoDbAPI, *resp.Type) + } + + d.Set("additional_properties", cosmosdb.AdditionalProperties) + d.Set("description", cosmosdb.Description) + + annotations := flattenDataFactoryAnnotations(cosmosdb.Annotations) + if err := d.Set("annotations", annotations); err != nil { + return fmt.Errorf("setting `annotations`: %+v", err) + } + + parameters := flattenDataFactoryParameters(cosmosdb.Parameters) + if err := d.Set("parameters", parameters); err != nil { + return fmt.Errorf("setting `parameters`: %+v", err) + } + + if connectVia := cosmosdb.ConnectVia; connectVia != nil { + if connectVia.ReferenceName != nil { + d.Set("integration_runtime_name", connectVia.ReferenceName) + } + } + + databaseName := cosmosdb.CosmosDbMongoDbAPILinkedServiceTypeProperties.Database + d.Set("database", databaseName) + + versionAbove32 := cosmosdb.CosmosDbMongoDbAPILinkedServiceTypeProperties.IsServerVersionAbove32 + d.Set("server_version_is_32_or_higher", versionAbove32) + + return nil +} + +func resourceDataFactoryLinkedServiceCosmosDbMongoAPIDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DataFactory.LinkedServiceClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.LinkedServiceID(d.Id()) + if err != nil { + return err + } + + response, err := client.Delete(ctx, id.ResourceGroup, id.FactoryName, id.Name) + if err != nil { + if !utils.ResponseWasNotFound(response) { + return fmt.Errorf("deleting Data Factory Linked Service CosmosDb %q (Data Factory %q / Resource Group %q): %+v", id.Name, id.FactoryName, id.ResourceGroup, err) + } + } + + return nil +} diff --git a/internal/services/datafactory/data_factory_linked_service_cosmosdb_mongoapi_resource_test.go b/internal/services/datafactory/data_factory_linked_service_cosmosdb_mongoapi_resource_test.go new file mode 100644 index 000000000000..04020866723a --- /dev/null +++ b/internal/services/datafactory/data_factory_linked_service_cosmosdb_mongoapi_resource_test.go @@ -0,0 +1,220 @@ +package datafactory_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type LinkedServiceCosmosDBMongoAPIResource struct { +} + +func TestAccDataFactoryLinkedServiceCosmosDbMongoAPI_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_data_factory_linked_service_cosmosdb_mongoapi", "test") + r := LinkedServiceCosmosDBMongoAPIResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("connection_string"), + }) +} + +func TestAccDataFactoryLinkedServiceCosmosDbMongoAPI_serverVersionAbove32(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_data_factory_linked_service_cosmosdb_mongoapi", "test") + r := LinkedServiceCosmosDBMongoAPIResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.serverVersionAbove32(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("connection_string"), + }) +} + +func TestAccDataFactoryLinkedServiceCosmosDbMongoAPI_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_data_factory_linked_service_cosmosdb_mongoapi", "test") + r := LinkedServiceCosmosDBMongoAPIResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.update1(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("parameters.%").HasValue("2"), + check.That(data.ResourceName).Key("annotations.#").HasValue("3"), + check.That(data.ResourceName).Key("additional_properties.%").HasValue("2"), + check.That(data.ResourceName).Key("description").HasValue("test description"), + ), + }, + data.ImportStep("connection_string"), + { + Config: r.update2(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("parameters.%").HasValue("3"), + check.That(data.ResourceName).Key("annotations.#").HasValue("2"), + check.That(data.ResourceName).Key("additional_properties.%").HasValue("1"), + check.That(data.ResourceName).Key("description").HasValue("test description 2"), + ), + }, + data.ImportStep("connection_string"), + }) +} + +func (t LinkedServiceCosmosDBMongoAPIResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.LinkedServiceID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.DataFactory.LinkedServiceClient.Get(ctx, id.ResourceGroup, id.FactoryName, id.Name, "") + if err != nil { + return nil, fmt.Errorf("reading Data Factory CosmosDB (%s): %+v", *id, err) + } + + return utils.Bool(resp.ID != nil), nil +} + +func (LinkedServiceCosmosDBMongoAPIResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-df-%d" + location = "%s" +} + +resource "azurerm_data_factory" "test" { + name = "acctestdf%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_data_factory_linked_service_cosmosdb_mongoapi" "test" { + name = "acctestlscosmosdb%d" + resource_group_name = azurerm_resource_group.test.name + data_factory_name = azurerm_data_factory.test.name + connection_string = "mongodb://testinstance:testkey@testinstance.documents.azure.com:10255/?ssl=true" +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (LinkedServiceCosmosDBMongoAPIResource) serverVersionAbove32(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-df-%d" + location = "%s" +} + +resource "azurerm_data_factory" "test" { + name = "acctestdf%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_data_factory_linked_service_cosmosdb_mongoapi" "test" { + name = "acctestlscosmosdb%d" + resource_group_name = azurerm_resource_group.test.name + data_factory_name = azurerm_data_factory.test.name + connection_string = "mongodb://testinstance:testkey@testinstance.documents.azure.com:10255/?ssl=true" + server_version_is_32_or_higher = true +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (LinkedServiceCosmosDBMongoAPIResource) update1(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-df-%d" + location = "%s" +} + +resource "azurerm_data_factory" "test" { + name = "acctestdf%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_data_factory_linked_service_cosmosdb_mongoapi" "test" { + name = "acctestlscosmosdb%d" + resource_group_name = azurerm_resource_group.test.name + data_factory_name = azurerm_data_factory.test.name + connection_string = "mongodb://testinstance:testkey@testinstance.documents.azure.com:10255/?ssl=true" + annotations = ["test1", "test2", "test3"] + description = "test description" + + parameters = { + foo = "test1" + bar = "test2" + } + + additional_properties = { + foo = "test1" + bar = "test2" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + +func (LinkedServiceCosmosDBMongoAPIResource) update2(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-df-%d" + location = "%s" +} + +resource "azurerm_data_factory" "test" { + name = "acctestdf%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_data_factory_linked_service_cosmosdb_mongoapi" "test" { + name = "acctestlscosmosdb%d" + resource_group_name = azurerm_resource_group.test.name + data_factory_name = azurerm_data_factory.test.name + connection_string = "mongodb://testinstance:testkey@testinstance.documents.azure.com:10255/?ssl=true" + annotations = ["test1", "test2"] + description = "test description 2" + + parameters = { + foo = "test1" + bar = "test2" + buzz = "test3" + } + + additional_properties = { + foo = "test1" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} diff --git a/internal/services/datafactory/registration.go b/internal/services/datafactory/registration.go index 362e8c42b615..bbfb08e2dcb9 100644 --- a/internal/services/datafactory/registration.go +++ b/internal/services/datafactory/registration.go @@ -55,6 +55,7 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_data_factory_linked_service_azure_sql_database": resourceDataFactoryLinkedServiceAzureSQLDatabase(), "azurerm_data_factory_linked_service_azure_table_storage": resourceDataFactoryLinkedServiceAzureTableStorage(), "azurerm_data_factory_linked_service_cosmosdb": resourceDataFactoryLinkedServiceCosmosDb(), + "azurerm_data_factory_linked_service_cosmosdb_mongoapi": resourceDataFactoryLinkedServiceCosmosDbMongoAPI(), "azurerm_data_factory_linked_service_data_lake_storage_gen2": resourceDataFactoryLinkedServiceDataLakeStorageGen2(), "azurerm_data_factory_linked_service_key_vault": resourceDataFactoryLinkedServiceKeyVault(), "azurerm_data_factory_linked_service_kusto": resourceDataFactoryLinkedServiceKusto(), diff --git a/website/docs/r/data_factory_linked_service_cosmosdb.html.markdown b/website/docs/r/data_factory_linked_service_cosmosdb.html.markdown index 3c2767b02926..efd5d8d7d55f 100644 --- a/website/docs/r/data_factory_linked_service_cosmosdb.html.markdown +++ b/website/docs/r/data_factory_linked_service_cosmosdb.html.markdown @@ -3,12 +3,12 @@ subcategory: "Data Factory" layout: "azurerm" page_title: "Azure Resource Manager: azurerm_data_factory_linked_service_cosmosdb" description: |- - Manages a Linked Service (connection) between an SFTP Server and Azure Data Factory. + Manages a Linked Service (connection) between a CosmosDB and Azure Data Factory using SQL API. --- # azurerm_data_factory_linked_service_cosmosdb -Manages a Linked Service (connection) between a SFTP Server and Azure Data Factory. +Manages a Linked Service (connection) between a CosmosDB and Azure Data Factory using SQL API. ~> **Note:** All arguments including the client secret will be stored in the raw state as plain-text. [Read more about sensitive data in state](/docs/state/sensitive-data.html). diff --git a/website/docs/r/data_factory_linked_service_cosmosdb_mongoapi.html.markdown b/website/docs/r/data_factory_linked_service_cosmosdb_mongoapi.html.markdown new file mode 100644 index 000000000000..b6f690db503e --- /dev/null +++ b/website/docs/r/data_factory_linked_service_cosmosdb_mongoapi.html.markdown @@ -0,0 +1,89 @@ +--- +subcategory: "Data Factory" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_data_factory_linked_service_cosmosdb_mongoapi" +description: |- + Manages a Linked Service (connection) between a CosmosDB and Azure Data Factory using Mongo API. +--- + +# azurerm_data_factory_linked_service_cosmosdb_mongoapi + +Manages a Linked Service (connection) between a CosmosDB and Azure Data Factory using Mongo API. + +~> **Note:** All arguments including the client secret will be stored in the raw state as plain-text. [Read more about sensitive data in state](/docs/state/sensitive-data.html). + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_data_factory" "example" { + name = "example" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_data_factory_linked_service_cosmosdb_mongoapi" "example" { + name = "example" + resource_group_name = azurerm_resource_group.example.name + data_factory_name = azurerm_data_factory.example.name + connection_string = "mongodb://testinstance:testkey@testinstance.documents.azure.com:10255/?ssl=true" + database = "foo" + +} +``` + +## Argument Reference + +The following supported arguments are common across all Azure Data Factory Linked Services: + +* `name` - (Required) Specifies the name of the Data Factory Linked Service. Changing this forces a new resource to be created. Must be unique within a data + factory. See the [Microsoft documentation](https://docs.microsoft.com/en-us/azure/data-factory/naming-rules) for all restrictions. + +* `resource_group_name` - (Required) The name of the resource group in which to create the Data Factory Linked Service. Changing this forces a new resource + +* `data_factory_name` - (Required) The Data Factory name in which to associate the Linked Service with. Changing this forces a new resource. + +* `description` - (Optional) The description for the Data Factory Linked Service. + +* `integration_runtime_name` - (Optional) The integration runtime reference to associate with the Data Factory Linked Service. + +* `annotations` - (Optional) List of tags that can be used for describing the Data Factory Linked Service. + +* `parameters` - (Optional) A map of parameters to associate with the Data Factory Linked Service. + +* `additional_properties` - (Optional) A map of additional properties to associate with the Data Factory Linked Service. + +The following supported arguments are specific to CosmosDB Linked Service: + +* `database` - (Optional) The name of the database. + +* `connection_string` - (Required) The connection string. + +* `server_version_is_32_or_higher` - (Optional) Whether API server version is 3.2 or higher. Defaults to `false`. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the Data Factory Linked Service. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Data Factory Linked Service. +* `update` - (Defaults to 30 minutes) Used when updating the Data Factory Linked Service. +* `read` - (Defaults to 5 minutes) Used when retrieving the Data Factory Linked Service. +* `delete` - (Defaults to 30 minutes) Used when deleting the Data Factory Linked Service. + +## Import + +Data Factory Linked Service's can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_data_factory_linked_service_cosmosdb_mongoapi.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.DataFactory/factories/example/linkedservices/example +```