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

DNS Domain Record fails updating without a change #478

Closed
eljoth opened this issue Apr 30, 2024 · 10 comments
Closed

DNS Domain Record fails updating without a change #478

eljoth opened this issue Apr 30, 2024 · 10 comments
Assignees
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec

Comments

@eljoth
Copy link

eljoth commented Apr 30, 2024

What happened?

I am provisioning my CIVO cloud infrastructure via Pulumi.
On the first run, everything works fine, including provisioning of my DNS Name as well as its record.

Without changing the code, running pulumi up again, I get the following error:

  civo:index:DnsDomainRecord (74.220.31.244):
    error: 1 error occurred:
        * updating urn:pulumi:stg::bringalong::bringalong:infra:cloud:civo$civo:index/dnsDomainRecord:DnsDomainRecord::74.220.31.244: 1 error occurred:
        * [ERR] an error occurred while renamed the domain record 0b03252e-f4ad-402a-a360-e67d7602473c, ParameterDnsRecordTypeError: The type of the DNS record was invalid - only 'A', 'MX', 'CNAME' or 'TXT' are supported

A pulumi preview --diff shows no changes:

        ~ civo:index/dnsDomainRecord:DnsDomainRecord: (update)
            [id=0b03252e-f4ad-402a-a360-e67d7602473c]
            [urn=urn:pulumi:stg::bringalong::bringalong:infra:cloud:civo$civo:index/dnsDomainRecord:DnsDomainRecord::74.220.31.244]
            domainId  : "44cdafcc-2316-47ea-b279-60ebd3601d2d"
            name      : "api-stg.bringalong.io"
            ttl       : 600
            type      : "A"
            value     : "74.220.31.244"

Example

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := civosdk.NewDnsDomainRecord(ctx, "74.220.31.244", &civosdk.DnsDomainRecordArgs{
			Ttl:      pulumi.Int(600),
			Type:     pulumi.String("A"),
			DomainId: pulumi.String("44cdafcc-2316-47ea-b279-60ebd3601d2d"),
			Name:     pulumi.String("api-stg.bringalong.io"),
			Value:    pulumi.String("74.220.31.244"),
		})
		if err != nil {
			return err

		}
		return nil
	})
}

Output of pulumi about

CLI          
Version      3.114.0
Go Version   go1.22.2
Go Compiler  gc

Plugins
KIND      NAME          VERSION
resource  civo          2.3.14
resource  docker        3.6.1
language  go            unknown
resource  kubernetes    3.30.2
resource  mongodbatlas  3.14.3

Host     
OS       darwin
Version  14.4
Arch     arm64

This project is written in go: executable='/opt/homebrew/opt/go/libexec/bin/go' version='go version go1.22.2 darwin/arm64'

Current Stack: eljoth/bringalong/stg

TYPE                                                        URN
pulumi:pulumi:Stack                                         urn:pulumi:stg::bringalong::pulumi:pulumi:Stack::bringalong-stg
bringalong:infra:cloud:civo                                 urn:pulumi:stg::bringalong::bringalong:infra:cloud:civo::bringalong-stg
bringalong:db:mongodb                                       urn:pulumi:stg::bringalong::bringalong:db:mongodb::bringalong-stg
bringalong:docker:Server                                    urn:pulumi:stg::bringalong::bringalong:docker:Server::bringalong-stg
bringalong:infra:kubernetes                                 urn:pulumi:stg::bringalong::bringalong:infra:kubernetes::kubernetes
docker:image:Image                                          urn:pulumi:stg::bringalong::bringalong:docker:Server$docker:image:Image::bringalong-stg
pulumi:providers:mongodbatlas                               urn:pulumi:stg::bringalong::pulumi:providers:mongodbatlas::default
mongodbatlas:index/project:Project                          urn:pulumi:stg::bringalong::bringalong:db:mongodb$mongodbatlas:index/project:Project::bringalong-stg
pulumi:providers:civo                                       urn:pulumi:stg::bringalong::pulumi:providers:civo::default
civo:index/dnsDomainName:DnsDomainName                      urn:pulumi:stg::bringalong::bringalong:infra:cloud:civo$civo:index/dnsDomainName:DnsDomainName::bringalong-stg
mongodbatlas:index/serverlessInstance:ServerlessInstance    urn:pulumi:stg::bringalong::bringalong:db:mongodb$mongodbatlas:index/serverlessInstance:ServerlessInstance::bringalong-stg
civo:index/network:Network                                  urn:pulumi:stg::bringalong::bringalong:infra:cloud:civo$civo:index/network:Network::bringalong-stg
civo:index/firewall:Firewall                                urn:pulumi:stg::bringalong::bringalong:infra:cloud:civo$civo:index/firewall:Firewall::bringalong-stg
civo:index/kubernetesCluster:KubernetesCluster              urn:pulumi:stg::bringalong::bringalong:infra:cloud:civo$civo:index/kubernetesCluster:KubernetesCluster::bringalong-stg
mongodbatlas:index/databaseUser:DatabaseUser                urn:pulumi:stg::bringalong::bringalong:db:mongodb$mongodbatlas:index/databaseUser:DatabaseUser::bringalong-stg
pulumi:providers:kubernetes                                 urn:pulumi:stg::bringalong::bringalong:infra:kubernetes$pulumi:providers:kubernetes::kubernetes
mongodbatlas:index/projectIpAccessList:ProjectIpAccessList  urn:pulumi:stg::bringalong::bringalong:db:mongodb$mongodbatlas:index/projectIpAccessList:ProjectIpAccessList::ips
kubernetes:core/v1:Namespace                                urn:pulumi:stg::bringalong::bringalong:infra:kubernetes$kubernetes:core/v1:Namespace::bringalong
kubernetes:core/v1:Secret                                   urn:pulumi:stg::bringalong::bringalong:infra:kubernetes$kubernetes:core/v1:Secret::pull-secret
kubernetes:cert-manager.io/v1:Issuer                        urn:pulumi:stg::bringalong::bringalong:infra:kubernetes$kubernetes:cert-manager.io/v1:Issuer::issuer
kubernetes:core/v1:Service                                  urn:pulumi:stg::bringalong::bringalong:infra:kubernetes$kubernetes:core/v1:Service::api
kubernetes:networking.k8s.io/v1:Ingress                     urn:pulumi:stg::bringalong::bringalong:infra:kubernetes$kubernetes:networking.k8s.io/v1:Ingress::api
civo:index/dnsDomainRecord:DnsDomainRecord                  urn:pulumi:stg::bringalong::bringalong:infra:cloud:civo$civo:index/dnsDomainRecord:DnsDomainRecord::74.220.31.244
kubernetes:apps/v1:Deployment                               urn:pulumi:stg::bringalong::bringalong:infra:kubernetes$kubernetes:apps/v1:Deployment::api


Found no pending operations associated with stg

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/eljoth
User           eljoth
Organizations  eljoth
Token type     personal

Dependencies:
NAME                                          VERSION
github.com/pulumi/pulumi-civo/sdk/v2          v2.3.14
github.com/pulumi/pulumi-docker/sdk/v3        v3.6.1
github.com/pulumi/pulumi-kubernetes/sdk/v3    v3.30.2
github.com/pulumi/pulumi-mongodbatlas/sdk/v3  v3.14.3
github.com/pulumi/pulumi/sdk/v3               v3.113.3

Pulumi locates its logs in /var/folders/g6/f6098l_50fs3cps12m_j2yzw0000gn/T/ by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@eljoth eljoth added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 30, 2024
@iwahbe
Copy link
Member

iwahbe commented May 1, 2024

Hi @eljoth. Thanks for raising an issue here. We'll take a look as soon as we can.

@iwahbe iwahbe removed the needs-triage Needs attention from the triage team label May 1, 2024
@mikhailshilkov
Copy link
Member

@iwahbe Were you able to repro the issue and provide some ideas for workarounds or possible fixes?

@mikhailshilkov mikhailshilkov added the needs-triage Needs attention from the triage team label May 10, 2024
@iwahbe iwahbe added needs-repro Needs repro steps before it can be triaged or fixed awaiting-feedback Blocked on input from the author and removed needs-triage Needs attention from the triage team labels May 10, 2024
@iwahbe
Copy link
Member

iwahbe commented May 10, 2024

I wasn't able to repro. Running the program given yields:

  civo:index:DnsDomainRecord (74.220.31.244):
    error: 1 error occurred:
        * [ERR] failed to create a new domain record: DatabaseDNSDomainNotFoundError: Failed to find that DNS domain name in the internal database

Our last release included some changes to how we do diffs. @eljoth is the issue still present on v2.3.16?

@eljoth if the problem persists, can you post a pulumi program that we can run in our Civo account to reproduce the issue?

@eljoth
Copy link
Author

eljoth commented May 15, 2024

I am using the new version v2.3.16.
Running the program still results in the same error.

@iwahbe the updated code you can run is as follows (domainName creation was missing in the upper example)

import (
    civosdk "github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		domainName, err := civosdk.NewDnsDomainName(ctx, "test", &civosdk.DnsDomainNameArgs{
			Name: pulumi.String("bringalong.io"),
		},
		)

		if err != nil {
			return err
		}

		if _, err := civosdk.NewDnsDomainRecord(ctx, "74.220.31.244", &civosdk.DnsDomainRecordArgs{
			Ttl:      pulumi.Int(600),
			Type:     pulumi.String("A"),
			DomainId: domainName.ID(),
			Name:     pulumi.String("api-stg.bringalong.io"),
			Value:    pulumi.String("74.220.31.244"),
		}); err != nil {
			return err
		}
		return nil
	})
}

I also investigated the issue with @praneetloke and we could not figure out the issue.

@mikhailshilkov mikhailshilkov added needs-triage Needs attention from the triage team and removed needs-repro Needs repro steps before it can be triaged or fixed awaiting-feedback Blocked on input from the author labels May 15, 2024
@guineveresaenger guineveresaenger removed the needs-triage Needs attention from the triage team label May 15, 2024
@guineveresaenger guineveresaenger self-assigned this May 15, 2024
@guineveresaenger
Copy link
Contributor

guineveresaenger commented May 15, 2024

Hi @eljoth - thank you for the new program.

I also get a diff on preview and then an error on the second pulumi up after running your code. I changed the Name field to a different record but that's all.

However, my error is different:

Output of second pulumi preview and up, after creating the record, with details
guin repros/civo-478🦉 pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/guinevere-pulumi-corp/civo-478/dev/previews/09f53136-88d5-4a6d-954e-7974e440a591

     Type                           Name           Plan       Info
     pulumi:pulumi:Stack            civo-478-dev              
 ~   └─ civo:index:DnsDomainRecord  74.220.31.244  update     [diff: ~name]

Resources:
    ~ 1 to update
    2 unchanged

Do you want to perform this update? details
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:dev::civo-478::pulumi:pulumi:Stack::civo-478-dev]
    ~ civo:index/dnsDomainRecord:DnsDomainRecord: (update)
        [id=f45e2e15-6491-4dc6-84be-509ec7f7d073]
        [urn=urn:pulumi:dev::civo-478::civo:index/dnsDomainRecord:DnsDomainRecord::74.220.31.244]
      ~ name: "api-stg" => "api-stg.civofourseveneight.io"

Do you want to perform this update? yes
Updating (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/guinevere-pulumi-corp/civo-478/dev/updates/6

     Type                           Name           Status                  Info
     pulumi:pulumi:Stack            civo-478-dev   **failed**              1 error
 ~   └─ civo:index:DnsDomainRecord  74.220.31.244  **updating failed**     [diff: ~name]; 1 error

Diagnostics:
  civo:index:DnsDomainRecord (74.220.31.244):
    error: 1 error occurred:
    	* updating urn:pulumi:dev::civo-478::civo:index/dnsDomainRecord:DnsDomainRecord::74.220.31.244: 1 error occurred:
    	* [ERR] an error occurred while renamed the domain record f45e2e15-6491-4dc6-84be-509ec7f7d073, Error: Unknown error response - status: 400 Bad Request, code: 400, reason: {"code":"database_dns_record_already_exist","reason":"Failed to create a DNS record name in the internal database, that already exists"}
My version of the pulumi program
 import (
   civosdk "github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
   "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
   pulumi.Run(func(ctx *pulumi.Context) error {
   	domainName, err := civosdk.NewDnsDomainName(ctx, "civo-478", &civosdk.DnsDomainNameArgs{
   		Name: pulumi.String("civofourseveneight.io"),
   	},
   	)

   	if err != nil {
   		return err
   	}

   	if _, err := civosdk.NewDnsDomainRecord(ctx, "74.220.31.244", &civosdk.DnsDomainRecordArgs{
   		Ttl:      pulumi.Int(600),
   		Type:     pulumi.String("A"),
   		DomainId: domainName.ID(),
   		Name:     pulumi.String("api-stg.civofourseveneight.io"),
   		Value:    pulumi.String("74.220.31.244"),
   	}); err != nil {
   		return err
   	}
   	return nil
   })
}

The above code in Terraform presents the same error.

I cannot reproduce your particular error -

however I noticed from the details output that the provider was attempting to rename
"api-stg" => "api-stg.civofourseveneight.io".

It appears as though DnsDomainRecordArgs.Name cannot contain any . characters, and the initially supplied name of api-stg.civofourseveneight.io is in fact quietly truncated to api-stg somewhere, resulting in a diff every time you try to run pulumi up.

When I set DnsDomainRecordArgs.Name to "hello" there was no diff on the second pulumi up. Can you try something like this? The docs say the Name value corresponds to the part before the domain name.

Please let us know if this helps!

@eljoth
Copy link
Author

eljoth commented May 16, 2024

HI @guineveresaenger,
changing the name to only contain the subdomain instead of the whole DNS Name it works great.
Thanks for the hint!

Even though I obviously did not read the docs correctly, is this a candidate for validation improvement?
If that's the case, I can leave this issue open, otherwise I will close it.

@praneetloke
Copy link
Contributor

Brilliant! Thank you, @guineveresaenger! By the way, I do have one comment though:

however I noticed from the details output that the provider was attempting to rename "api-stg" => "api-stg.civofourseveneight.io".

I don't think we were seeing this diff or we definitely would have noticed what was going on. Here's a link to the pulumi preview --diff from when @eljoth reported this on Slack: https://pulumi-community.slack.com/archives/C01PF3E1B8V/p1714293493171259?thread_ts=1714162691.564549&cid=C01PF3E1B8V

@guineveresaenger
Copy link
Contributor

Yay! I'm glad you're unblocked. 🎉

@praneetloke - I do actually see this diff on my end. on pulumi preview --diff:

guin repros/civo-478🦉 pulumi preview --diff
Previewing update (dev)

View Live: https://app.pulumi.com/guinevere-pulumi-corp/civo-478/dev/previews/8fe4be12-6172-43b5-af79-d3997033233b

  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:dev::civo-478::pulumi:pulumi:Stack::civo-478-dev]
    ~ civo:index/dnsDomainRecord:DnsDomainRecord: (update)
        [id=93e306eb-88e9-46a3-b501-4b0ff0fbcc61]
        [urn=urn:pulumi:dev::civo-478::civo:index/dnsDomainRecord:DnsDomainRecord::74.220.31.244]
      ~ name: "api-stg" => "api-stg.civofourseveneight.io"
Resources:
    ~ 1 to update
    2 unchanged

But again, I don't have an exact repro for what you saw.

@eljoth - I agree validation can be better here. This would be a fix on the upstream Terraform provider. I'm going to file an issue there and mark this issue as awaiting upstream. 👍

@guineveresaenger
Copy link
Contributor

upstream issue: civo/terraform-provider-civo#211

@guineveresaenger guineveresaenger added the awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). label May 16, 2024
@guineveresaenger guineveresaenger removed their assignment May 16, 2024
@praneetloke
Copy link
Contributor

@guineveresaenger ah I think perhaps there was a bug in the CLI display (or TF bridge maybe?) that has been fixed since the time @eljoth and I were looking into this. I think it may have been 3.113.0 perhaps that he was on. Everything else was latest at the time then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

5 participants