Open hoses-h opened 2 years ago
@hoses-h , thank you for opening this issue. Could you please share more contexts say business documents describing the "Azure SaaS provider"? I tried searching that from search engines but no luck getting that in top returned search result. On the other hand, I speculate Terraform has not supported this feature yet, because though I did not find business docs, I found an API spec of that provider here. You can see that is a preview/beta API. Given this terraform provider generally only onboards GA (stable) features, I'm not sure whether in short term Terraform has plan to support that w/o getting clear service GA roadmap.
Please correct me if I misunderstand the background of this issue.
Hello,
The import command should be something like terraform import azurerm_saas.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.SaaS/resources/resource1
The following information is a sample output obtained from the command 'az resource show --ids /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.SaaS/resources/resource1' and it contains the paramenters a resource configuration like azurerm_saas should have in Terraform. { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.SaaS/resources/resource1", "identity": null, "kind": null, "location": "global", "managedBy": null, "name": "resource1", "plan": null, "properties": { "additionalInfo": null, "autoRenew": true, "created": "2020-02-05T10:11:16.2186349Z", "cspProperties": null, "isFreeTrial": false, "lastModified": "2022-06-06T13:20:59.2932236Z", "market": "ES", "offerId": "tsg-saas-offer", "orderId": null, "paymentChannelMetadata": { "azureSubscriptionId": "00000000-0000-0000-0000-000000000000" }, "paymentChannelType": "SubscriptionDelegated", "publisherId": "sendgrid", "publisherTestEnvironment": null, "quantity": null, "saasResourceName": "resource1", "saasSubscriptionId": "01111111-1111-1111-1111-111111111111", "skuId": "legacy-bronze", "status": "Subscribed", "statusReason": "None", "storeFront": "DevServiceMigration", "term": { "endDate": "2022-07-06T00:00:00Z", "startDate": "2022-06-06T00:00:00Z", "termId": null, "termUnit": "P1M" }, "termId": "erthbgwsdhfs" }, "resourceGroup": "mygroup1", "sku": null, "tags": {}, "type": "Microsoft.SaaS/resources" }
This image is what appears in Azure Console.
Sound similar to https://github.com/hashicorp/terraform-provider-azurerm/issues/6510
Yeah, what's odd is you can't export the template from the Resource Group (which explains why in #6510 they say it's not in the SDK), however you can export it from the Deployment on the Resource Group itself, e.g.:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "String"
},
"planId": {
"type": "String"
},
"offerId": {
"type": "String"
},
"publisherId": {
"type": "String"
},
"quantity": {
"type": "Int"
},
"termId": {
"type": "String"
},
"azureSubscriptionId": {
"type": "String"
},
"publisherTestEnvironment": {
"type": "String"
},
"autoRenew": {
"type": "Bool"
},
"location": {
"type": "String"
},
"tags": {
"type": "Object"
}
},
"resources": [
{
"type": "Microsoft.SaaS/resources",
"apiVersion": "2018-03-01-beta",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
"properties": {
"saasResourceName": "[parameters('name')]",
"publisherId": "[parameters('publisherId')]",
"SKUId": "[parameters('planId')]",
"offerId": "[parameters('offerId')]",
"quantity": "[parameters('quantity')]",
"termId": "[parameters('termId')]",
"autoRenew": "[parameters('autoRenew')]",
"paymentChannelType": "SubscriptionDelegated",
"paymentChannelMetadata": {
"AzureSubscriptionId": "[parameters('azureSubscriptionId')]"
},
"publisherTestEnvironment": "[parameters('publisherTestEnvironment')]",
"storeFront": "AzurePortal"
}
}
]
}
It seems this is a Resource, but not that well supported out of the box: https://docs.microsoft.com/en-us/azure/governance/resource-graph/reference/supported-tables-resources https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers
It'd be great for some form of support for it, but it's unlikely to happen while the SDK itself doesn't support it. (But how can we use these ARM templates then which do work as long as you get some of the random parameters correct)
Is there an existing issue for this?
Community Note
Description
Hello,
My name is Héctor.
I am required to have all of the Azure infrastructure of a company in Terraform code and we have a Sendgrid resource from the Microsoft.SaaS provider already deployed.
I would like to import that resource but the problem is that I cannot find any configuration resource in Terraform for that provider and resource type.
Could you please indicate if there exists any configuration I could use? and, if there is not any, could you please create it when your developers have the time?
Thank you.
Regards.
New or Affected Resource(s)/Data Source(s)
azurerm_saas
Potential Terraform Configuration
No response
References
No response