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_cosmosdb_account - support the Serverless value for the capabilities property #8533

Merged
merged 6 commits into from
Sep 21, 2020

Conversation

creotiv
Copy link
Contributor

@creotiv creotiv commented Sep 18, 2020

No description provided.

@ghost ghost added the size/XS label Sep 18, 2020
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.

Hey @creotiv, this change looks good but a test needs to be added and documentation needs to be updated before we can merge it in

@ghost ghost added the documentation label Sep 20, 2020
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @creotiv

Thanks for pushing those changes - taking a look through this now LGTM 👍

Thanks!

@@ -203,6 +203,7 @@ func resourceArmCosmosDbAccount() *schema.Resource {
"EnableCassandra",
"EnableGremlin",
"EnableTable",
"Serverless",
Copy link
Contributor

Choose a reason for hiding this comment

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

running the test for this we're getting:

Error: Error creating CosmosDB Account "acctest-ca-200921081838097854" (Resource Group "acctestRG-cosmos-200921081838097854"): Error creating/updating CosmosDB Account "acctest-ca-200921081838097854" (Resource Group "acctestRG-cosmos-200921081838097854"): documentdb.DatabaseAccountsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="Invalid capability Serverless.\r\nActivityId: 5dfe90e2-a83c-4a61-af17-3422cdd0de68, Microsoft.Azure.Documents.Common/2.11.0"

Provisioning one of these in the Azure Portal and then generating the ARM Template here gives us:

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "name": {
            "type": "string"
        },
        "location": {
            "type": "string"
        },
        "locationName": {
            "type": "string"
        },
        "defaultExperience": {
            "type": "string"
        },
        "isZoneRedundant": {
            "type": "string"
        }
    },
    "variables": {},
    "resources": [
        {
            "apiVersion": "2020-04-01",
            "kind": "GlobalDocumentDB",
            "type": "Microsoft.DocumentDb/databaseAccounts",
            "name": "[parameters('name')]",
            "location": "[parameters('location')]",
            "properties": {
                "databaseAccountOfferType": "Standard",
                "locations": [
                    {
                        "id": "[concat(parameters('name'), '-', parameters('location'))]",
                        "failoverPriority": 0,
                        "locationName": "[parameters('locationName')]"
                    }
                ],
                "backupPolicy": {
                    "type": "Periodic",
                    "periodicModeProperties": {
                        "backupIntervalInMinutes": 240,
                        "backupRetentionIntervalInHours": 8
                    }
                },
                "isVirtualNetworkFilterEnabled": false,
                "virtualNetworkRules": [],
                "ipRules": [],
                "dependsOn": [],
                "capabilities": [
                    {
                        "name": "EnableServerless"
                    }
                ],
                "enableFreeTier": false
            },
            "tags": {
                "defaultExperience": "[parameters('defaultExperience')]",
                "hidden-cosmos-mmspecial": "",
                "CosmosAccountType": "Non-Production"
            }
        }
    ],
    "outputs": {}
}

With the variables:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "name": {
            "value": "testtttttttttt"
        },
        "location": {
            "value": "westus"
        },
        "locationName": {
            "value": "West US"
        },
        "defaultExperience": {
            "value": "Core (SQL)"
        },
        "isZoneRedundant": {
            "value": "false"
        }
    }
}

Since we're using that API version, perhaps this also needs the tags set to be able to provision this?

It's worth noting in the preview documentation that Microsoft says at this time this is only available via the Azure Portal, so there could be some behind-the-scenes magic here too:

During the preview release, the only supported way to create a new serverless account is by using the Azure portal. Migrating existing accounts to/from serverless mode is not currently supported.

@katbyte katbyte changed the title Add support for "Serverless" capability azurerm_cosmosdb_account - support the Serverless value for the capabilities property Sep 21, 2020
@katbyte katbyte added this to the v2.29.0 milestone Sep 21, 2020
@katbyte katbyte merged commit 2ac0020 into hashicorp:master Sep 21, 2020
katbyte added a commit that referenced this pull request Sep 21, 2020
@ghost
Copy link

ghost commented Sep 24, 2020

This has been released in version 2.29.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.29.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Oct 22, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 22, 2020
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.

4 participants