-
Notifications
You must be signed in to change notification settings - Fork 51
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
Struggle to update a cosmos db account #219
Comments
Problem 2 looks like another manifestation of hashicorp/terraform-provider-azurerm#2602. |
I looked into (1) a bit. The addition of the second element of
Note in particular That said, looking at the Terraform Schema for this, I cannot explain why this change would trigger a replacement. I'll need to debug a little deeper. There are a few slightly unusual things happening around normalization (both diff suppression and statefile storage normalization) for the |
For reference - here is the repro: import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("resourceGroup", {
location: "WestUS",
});
// Create an Azure resource (Storage Account)
const account = new azure.storage.Account("storage", {
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
accountTier: "Standard",
accountReplicationType: "LRS",
});
const cosmosdb = new azure.cosmosdb.Account("cosmosDb", {
kind: "MongoDB",
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
consistencyPolicy: {
consistencyLevel: "BoundedStaleness",
maxIntervalInSeconds: 10,
maxStalenessPrefix: 200
},
offerType: "Standard",
enableAutomaticFailover: true,
geoLocations: [
{ location: "WestUS", failoverPriority: 0 },
// { location: "EastUS", failoverPriority: 1 }
]
});
// Export the connection string for the storage account
export const endpoint = cosmosdb.endpoint; |
The issue in step (1) is a bug in the upstream Terraform AzureRM provider. The The issue in step (2) is hashicorp/terraform-provider-azurerm#2602. The issue in step (3) is expected - though not ideal - if the provider does not return back a resource id, there is no way for Pulumi to know what was created. So due to the bug in (2), we never get told what resource was created, and it gets orphaned. There is nothing Pulumi can really do here - we just need to avoid having bugs like (2) in the providers. |
Thanks for your analysis @lukehoban |
Opened hashicorp/terraform-provider-azurerm#3532.
Definitely feel free to open an issue and/or PR on that upstream as well! |
This looks like several unrelated issues, but I decided to bump them all here.
I had a Pulumi program which defined a Cosmos DB account with 1 region:
pulumi up
worked and everything was ok.Now, I changed the account to have two replicas:
Problem 1.
pulumi up
now suggests replacing my existing account with data with a new one:the reason is that the name changed. Why is that?
Okay, I proceed with the change. Creating an account takes time.
Problem 2. After ~10 minutes
pulumi
quits with this message:Sounds sort of similar to #217 but with a very different error message.
Problem 3. In fact, my Cosmos DB account is created. But when I run
pulumi up
it renames the account again and starts creating a new one (a third one).Eventually, I succeeded to create an updated Cosmos account. However,
pulumi
keeps suggesting to replace it on everyup
command.A workaround of specifying the full name explicitly seems to help.
The text was updated successfully, but these errors were encountered: