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

database_replica's URN not available #1242

Open
renanbr opened this issue Oct 7, 2024 · 1 comment
Open

database_replica's URN not available #1242

renanbr opened this issue Oct 7, 2024 · 1 comment
Labels

Comments

@renanbr
Copy link

renanbr commented Oct 7, 2024

Bug Report

I'm importing existing resources.

When defining a project where I would like to attach the replica, URN isn't available.

resource "digitalocean_project" "default" {
  // ...
  resources = [
    // ....
    digitalocean_database_replica.mysql_read_only.urn,
  ]
}

Describe the bug

The apply command doesn't work.

Affected Resource(s)

  • digitalocean_database_replica

Expected Behavior

Having the replace attached to the project.

Actual Behavior

│ Error: Unsupported attribute
│
│   on application/project.tf line 8, in resource "digitalocean_project" "default":
│    8:     digitalocean_database_replica.mysql_read_only.urn,
│
│ This object has no argument, nested block, or exported attribute named "urn". Did you mean "uri"?

Steps to Reproduce

  1. Define a digitalocean_project resource
  2. Define a digitalocean_database_cluster resource
  3. Define a digitalocean_database_replica resource
  4. Attach the replica as resource of a digitalocean_project resource
  5. Run terraform apply

Terraform Configuration Files

provider "registry.terraform.io/digitalocean/digitalocean" {
  version     = "2.42.0"
  constraints = "~> 2.0"
  // ...
}

Terraform version

Terraform v1.9.6
on darwin_arm64

Debug Output

none

Panic Output

none

Additional context

I'm currently interpolating the id when attaching it to the project.

"do:dbaas:${digitalocean_database_replica.mysql_read_only.uuid}"

Important Factoids

I'm aware about the solution found in #639

References

none

@renanbr renanbr added the bug label Oct 7, 2024
@loosla
Copy link
Contributor

loosla commented Oct 11, 2024

Hi Renan,

Thank you for your feedback regarding the use of project resources in our API. I appreciate your input.

A bit more context about the issue:

digitalocean_project_resources requires resources to follow urn format: api doc.
Using raw uuid instead of urn or anything that doesn't follow the urn format triggers an error on terraform apply:

Error: Error creating Project: Error assigning resources: POST https://api.digitalocean.com/v2/projects/34f99b72-4f48-49c1-bc2d-48722a56997a/resources: 400 (request "abc123") resource objects must have an urn in the following format: do:resource_type:resource_id

I appreciate you bringing this to our attention. I’ll need to discuss it with the team to determine the priority and the best approach to enhance the user experience.

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