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

Provider produced inconsistent result after apply for digitalocean_database_user #1038

Open
JonZudell opened this issue Oct 1, 2023 · 1 comment
Labels

Comments

@JonZudell
Copy link

Bug Report


Describe the bug

when running terraform -chroot=dir apply on my project at
https://github.com/fugue-state-io/terraform/tree/abe1b6141a1387303aaced3a0bf576ab095816e3

digitalocean_project_resources.kubernetes_resources: Creation complete after 2s [id=659726cb-f350-4c2e-89a1-70e2a3a50941]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to digitalocean_database_user.argo-db-user, provider "provider[\"registry.terraform.io/digitalocean/digitalocean\"]" produced an unexpected new value: Root resource was present, but now
│ absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Affected Resource(s)

  • digitalocean_database_user

Expected Behavior

The user should have been created.

Actual Behavior

Provider produced an inconsistent result

Steps to Reproduce

checkout
https://github.com/fugue-state-io/terraform/tree/abe1b6141a1387303aaced3a0bf576ab095816e3

Terraform Configuration Files

db.tf

# resources
resource "digitalocean_database_cluster" "postgres" {
  name       = "fugue-state-postgres-cluster"
  engine     = "pg"
  version    = "14"
  size       = "db-s-1vcpu-1gb"
  region     = "nyc3"
  node_count = 1
  private_network_uuid = digitalocean_vpc.fugue-state-vpc.id
}

resource "digitalocean_database_db" "postgres-db" {
  depends_on = [ digitalocean_database_cluster.postgres ]
  cluster_id = digitalocean_database_cluster.postgres.id
  name       = "postgres"
}

resource "digitalocean_database_user" "argo-db-user" {
  depends_on = [ digitalocean_database_cluster.postgres ]
  cluster_id = digitalocean_database_cluster.postgres.id
  name       = "argo-user"
}

resource "digitalocean_database_firewall" "postgres-fw" {
  depends_on = [ digitalocean_database_cluster.postgres ]
  cluster_id = digitalocean_database_cluster.postgres.id

  rule {
    type  = "k8s"
    value = digitalocean_kubernetes_cluster.fugue-state-cluster.id
  }
}

# Database Clusters
resource "digitalocean_project_resources" "db_resources" {
  depends_on = [ digitalocean_database_cluster.postgres ]
  project = digitalocean_project.fugue-state-io.id
  resources = [
    digitalocean_database_cluster.postgres.urn
  ]
}

Terraform version

Terraform v1.5.7
on linux_amd64

Additional context

Rerunning i get this output

digitalocean_database_user.argo-db-user: Creating...
digitalocean_project_resources.kubernetes_resources: Modifying... [id=659726cb-f350-4c2e-89a1-70e2a3a50941]
digitalocean_project_resources.kubernetes_resources: Modifications complete after 2s [id=659726cb-f350-4c2e-89a1-70e2a3a50941]
╷
│ Error: Error creating Database User: POST https://api.digitalocean.com/v2/databases/d0455f0c-2d72-4ecf-921b-8d15bf9a0d94/users: 422 (request "f122f8d2-cb4e-4cd5-b996-49dda7a5562e") user with that name already exists
│ 
│   with digitalocean_database_user.argo-db-user,
│   on db.tf line 18, in resource "digitalocean_database_user" "argo-db-user":
│   18: resource "digitalocean_database_user" "argo-db-user" {
│ 
╵

Important Factoids

References

@JonZudell JonZudell added the bug label Oct 1, 2023
@andrewsomething
Copy link
Member

Hi

What version of the Terraform provider are you using? The v2.30.0 release contained a number of bug fixes around the digitalocean_database_user resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants