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

[BUG] Input validation for civo_dns_domain_record name field #211

Closed
guineveresaenger opened this issue May 16, 2024 · 0 comments · Fixed by #218
Closed

[BUG] Input validation for civo_dns_domain_record name field #211

guineveresaenger opened this issue May 16, 2024 · 0 comments · Fixed by #218
Labels
bug Something isn't working

Comments

@guineveresaenger
Copy link

Description

Situation:

When attempting to create a civo_dns_domain_record with a name of the format foo.bar.baz, and there is an existing civo_dns_domain_name with name bar.baz, the provider truncates the domain record's name value quietly to foo. The docs do point out that this is the expected input for this field, so some of this is user error, but it's an honest mistake to make, IMO.

This results in a permanent diff on every subsequent terraform plan.

What I would expect:
Initial terraform apply fails with an invalid input error.

Screenshots

Sample code:

terraform {
  required_providers {
    civo = {
      source = "civo/civo"
      version = "1.0.41"
    }
  }
}

provider "civo" {
}

resource "civo_dns_domain_name" "civo-478" {
  name = "bar.baz"
}

resource "civo_dns_domain_record" "record_74_220_31_243" {
  domain_id = civo_dns_domain_name.civo-478.id
  name      = "api-stg.bar.baz"
  value     = "74.220.31.244"
  type      = "A"
  ttl       = 600
}

First apply succeeds, thereafter terraform plan shows the following:

guin terraform-programs/civo-478🦉 terraform plan
civo_dns_domain_name.civo-478: Refreshing state... [id=c446be04-cae0-4234-8ed0-3c70cdd37ccc]
civo_dns_domain_record.record_74_220_31_243: Refreshing state... [id=31afa1d0-8832-4541-84fd-0f7d20a60e45]

Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # civo_dns_domain_record.record_74_220_31_243 will be updated in-place
  ~ resource "civo_dns_domain_record" "record_74_220_31_243" {
        id         = "31afa1d0-8832-4541-84fd-0f7d20a60e45"
      ~ name       = "api-stg" -> "api-stg.bar.baz"
        # (7 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Output of Terraform version

terraform version
Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/civo/civo v1.0.41

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant