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

When creating volumes, "region" is not being converted to lowercase letters and causes an error during terraform apply #901

Closed
nixc0 opened this issue Nov 18, 2022 · 1 comment

Comments

@nixc0
Copy link

nixc0 commented Nov 18, 2022

Bug Report


Describe the bug

When using uppercase letters in region (example NYC3 or AMS1) when creating a new volume causes terraform apply to fail

Affected Resource(s)

  • digitalocean_volume

If this issue appears to affect multiple resources, it may be an issue with
Terraform's core, so please mention this. -->

Expected Behavior

Region should have been converted to lowercase nyc3 and volume created. This is the behavior that happens when I create a Droplet using the region NYC3.

Actual Behavior

When running terraform apply the following error is produced.
Error: Error creating Volume: POST https://api.digitalocean.com/v2/volumes: 403 (request "51693f34-b786-44e3-8fe1-8ac3dcbe7e1a") failed to create volume: volume allocation operations not allowed in this region at this time

Steps to Reproduce

Terraform Configuration Files
Here is an example of the Droplet I am creating at the same time using "NYC3" as the region instead of "nyc3". This works as expected.

terraform {
  required_providers {
    digitalocean = {
      source = "digitalocean/digitalocean"
      version = "~> 2.0"
    }
  }
}
variable "do_token" {}

provider "digitalocean" {
  token = var.do_token
}
resource "digitalocean_droplet" "www-1" {
    image = "ubuntu-20-04-x64"
    name = "www-1"
    region = "NYC3"
    size = "s-1vcpu-1gb"
}

During the same plan and apply, below is the configuration file for the volume I am creating with "NYC3" as the region instead of "nyc3".

resource "digitalocean_volume" "foobar" {
  region                  = "NYC3"
  name                    = "baz"
  size                    = 100
  initial_filesystem_type = "ext4"
  description             = "an example volume"
}

Terraform version

I replicated this issue on 1.3.4 & 1.3.5

Debug Output

https://gist.github.com/nixc0/0864906078831e9a65bf6ce7c8f16f31
Panic Output

Additional context

If I'm not mistaken, this line

should be converting this "NYC3" to "nyc3" in order to work with the all lowercase requirements of the DO API.

@andrewsomething
Copy link
Member

Fixed via #1074

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

No branches or pull requests

3 participants