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

digitalocean_database_opensearch_config creation fails #1266

Open
brianhelba opened this issue Nov 15, 2024 · 1 comment
Open

digitalocean_database_opensearch_config creation fails #1266

brianhelba opened this issue Nov 15, 2024 · 1 comment
Labels

Comments

@brianhelba
Copy link

Bug Report

Describe the bug

Creation of a new digitalocean_database_opensearch_config fails.

Affected Resource(s)

  • digitalocean_database_opensearch_config

Steps to Reproduce

  1. With a resource definition like:

    resource "digitalocean_database_opensearch_config" "elasticsearch" {
      cluster_id = digitalocean_database_cluster.elasticsearch.id
    
      # Adding additional optional arguments does not change the failing behavior
    }

    creation via terraform apply fails with the error (unique identifiers are redacted with xxxx):

    │ Error: Error updating Opensearch configuration: PATCH https://api.digitalocean.com/v2/databases/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/config: 422 (request "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") the mask must be set with which fields are being updated
    
  2. Running TF_LOG=DEBUG terraform apply shows that the HTTP API request to DigitialOcean is:

    ---[ REQUEST ]---------------------------------------
    PATCH /v2/databases/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/config HTTP/1.1
    Host: api.digitalocean.com
    User-Agent: Terraform/1.9.8 godo/1.126.0
    Content-Length: 14
    Accept: application/json
    Content-Type: application/json
    Accept-Encoding: gzip
    
    {
     "config": {}
    }
    

    with a response (some non-essential headers redacted):

    ---[ RESPONSE ]--------------------------------------
    HTTP/2.0 422 Unprocessable Entity
    Content-Length: 151
    Content-Type: application/json; charset=utf-8
    Server: cloudflare
    SameSite=None
    
    {
     "message": "the mask must be set with which fields are being updated",
     "id": "unprocessable_entity",
     "request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
    
  3. As noted above, adding additional optional arguements to the digitalocean_database_opensearch_config resource does not change the behavior: the underlying HTTP request still sends a PATCH with an empty config in the body.

Workaround

Import of a digitalocean_database_opensearch_config still succeeds. Since the underlying DigialOcean resource always already exists (it's created along with the database cluster), performing a Terraform import prevents the resource from failing on future applies.

Terraform version

Terraform v1.9.8

@andrewsomething
Copy link
Member

Hi @brianhelba,

Thanks for the bug report. I can reproduce the initial error you mentioned, and have a fix in #1268

As noted above, adding additional optional arguements to the digitalocean_database_opensearch_config resource does not change the behavior: the underlying HTTP request still sends a PATCH with an empty config in the body.

Though I have not been able to reproduce this. Could you share an example config that you saw this for?

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