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

There is no minimum on services #1305

Merged
merged 3 commits into from
Jan 23, 2025
Merged

Conversation

Xowap
Copy link
Contributor

@Xowap Xowap commented Jan 14, 2025

The schema validation forces to have at least one service, however it's not actually a requirement from DigitalOcean.

In this PR I'm lowering the minimum to zero, I'm not sure if there are more things to be done?

@andrewsomething
Copy link
Member

Hi @Xowap,

Thanks for the PR. Though I want to make sure that I understand the problem you are running into better so that we can be sure this will actually resolve it. I don't think setting MinItems: 1 is actually necessary here, but it shouldn't be preventing the creation of apps without a service. For example, I am able to successfully create an app with this config only containing a worker:

resource "digitalocean_app" "worker-sample" {
  spec {
    name   = "worker-sample"
    region = "nyc"

      worker {
        name               = "go-worker"
        instance_size_slug = "apps-d-1vcpu-0.5gb"
        instance_count     = 1

      git {
        repo_clone_url = "https://github.com/digitalocean/sample-sleeper.git"
        branch         = "main"
      }
    }
  }
}

@Xowap
Copy link
Contributor Author

Xowap commented Jan 23, 2025

It's kind of the issue I'm running into (through Pulumi though, so not sure if this has any impact?): I'm trying to create an app with just one worker and I can't because it doesn't have a service. I managed to get around that by getting the container to pose as a service, but that's definitely not ideal.

@andrewsomething
Copy link
Member

It seems like Pulumi must evaluate this differently somehow. The Terraform SDK says:

If the field Optional is set to true then MinItems is ignored and thus effectively zero.

https://github.com/hashicorp/terraform-plugin-sdk/blob/b11308dc8f0ff4a03f750ba012e7bc7d3974e895/helper/schema/schema.go#L239-L241

Either way, let's remove it as it's not needed.

@andrewsomething andrewsomething merged commit 73a08ed into digitalocean:main Jan 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants