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 Record Not Updated #952

Open
IdoOzeri opened this issue Nov 5, 2024 · 6 comments
Open

DNS Record Not Updated #952

IdoOzeri opened this issue Nov 5, 2024 · 6 comments
Labels
awaiting-feedback Blocked on input from the author kind/bug Some behavior is incorrect or out of spec needs-repro Needs repro steps before it can be triaged or fixed
Milestone

Comments

@IdoOzeri
Copy link

IdoOzeri commented Nov 5, 2024

Describe what happened

I'm using version 5.42.0 of the pulumi-cloudflare package in Python.

Recently, we've been getting this warning:

warning: urn:pulumi:staging::base-infra::DnsComponents$cloudflare:index/record:Record::nginx-router verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

My DNS record was successfully created using the value argument. However, the bug occurs when updating the value.
Pulumi detects there's a change:

~ cloudflare:index/record:Record: (update)
            [id=aa2c903e12b979b17da0151a72b385c4]
            [urn=urn:pulumi:staging::base-infra::DnsComponents$cloudflare:index/record:Record::nginx-router]
            [provider=urn:pulumi:staging::base-infra::pulumi:providers:cloudflare::default_5_42_0::a7cc479e-e2e7-4306-9115-e4422dcc773a]
          ~ value: "a210ef00ef01c4d6c9c7051088eaccb5-95cd3a4454873012.elb.eu-west-1.amazonaws.com" => "a8eb67009cbaf48a3a6230191c3ff866-a30dd21408d1c0d3.elb.eu-west-1.amazonaws.com"

And proceeds to update the record:

~      └─ cloudflare:index:Record                            nginx-router                                   updated (3s)        [diff: ~value]; 1 warning

However, on Cloudflare, the record still contains the old value. Nothing has changed.
Changing the code to use content instead of value - solves the issue and the record is indeed updated on Cloudflare.

This behaviour is very misleading, as the warning might seem benign at first glance.
I think the warning should at the very least include a message that DNS records with value argument can be created but CANNOT be updated.

Sample program

   Record("nginx-router",
            zone_id=<your-zone-id>,
            name="test-record",
            type="CNAME",
            value="some-value",
            ttl=60,
            proxied=False
        )

Log output

No response

Affected Resource(s)

No response

Output of pulumi about

CLI          
Version      3.137.0
Go Version   go1.23.2
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  aws         6.57.0
resource  awsx        2.16.1
resource  cloudflare  5.42.0
resource  docker      4.5.7
resource  eks         2.8.1
resource  kubernetes  4.18.3
language  python      unknown

Host     
OS       ubuntu
Version  22.04
Arch     x86_64


TYPE                                                       URN

cloudflare:index/record:Record                             urn:pulumi:staging::base-infra::DnsComponents$cloudflare:index/record:Record::nginx-router


Found no pending operations associated with staging



Dependencies:
NAME                  VERSION
pip                   24.2
pulumi_cloudflare     5.42.0


Pulumi locates its logs in /tmp 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).

@IdoOzeri IdoOzeri added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 5, 2024
@pierskarsenbarg
Copy link
Member

It looks like there's been a deprecation warning added to the value field and that you should use contentor data moving forward: https://www.pulumi.com/registry/packages/cloudflare/api-docs/record/#value_nodejs

@IdoOzeri
Copy link
Author

IdoOzeri commented Nov 5, 2024

It looks like there's been a deprecation warning added to the value field and that you should use contentor data moving forward: https://www.pulumi.com/registry/packages/cloudflare/api-docs/record/#value_nodejs

True, but why is it a warning? If it's deprecated effective-immediately and should not be used - then you should throw an error.
The warning states it will be removed in the next major release, ergo it is still supported.
Moreover, Pulumi acts as if it had changed the resource, when in fact it did not. That's the troubling part.

@guineveresaenger
Copy link
Contributor

Hi @IdoOzeri - we're sorry your encountering trouble here.

I've run a basic Zone + Record example using value and cannot duplicate your issue.

import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

const zone = new cloudflare.Zone("my-zone", {
    zone: `ts-test-test-cloudflare-pulumi.com`,
    accountId: "redacted",
});
// Add a record to the domain
const example = new cloudflare.Record("example", {
    zoneId: zone.id,
    name: "example",
    value: "192.0.2.1",
    type: "A",
    ttl: 3600,
});

=> pulumi up sends a warning this field has been deprecated but succeeds.

Looking at the zone on cloudflare console; the record exists:

import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

const zone = new cloudflare.Zone("my-zone", {
    zone: `ts-test-test-cloudflare-pulumi.com`,
    accountId: "redacted",
});
// Add a record to the domain
const example = new cloudflare.Record("example", {
    zoneId: zone.id,
    name: "example",
    value: "192.0.2.2", # update the value
    type: "A",
    ttl: 3600,
});

=> pulumi up sends the same deprecation warning; upgrade runs successfully.

Looking at the zone on cloudflare console, I do need to refresh the page, but the record has successfully been updated.

If you do continue to see this behavior on your side, please send us a minimal runnable repro that shows this bug.

@guineveresaenger guineveresaenger 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 Nov 6, 2024
@mjeffryes mjeffryes added this to the 0.113 milestone Nov 13, 2024
@ringods
Copy link
Member

ringods commented Nov 27, 2024

@guineveresaenger I was able to reproduce this with this Python program:

import pulumi
import pulumi_cloudflare as cloudflare

config = pulumi.Config()

zone = cloudflare.Zone("zd6105-zone",
    zone = 'py-test-cloudflare-pulumi.com',
    account_id = config.require_secret('accountId'),
)

# Add a record to the domain
example = cloudflare.Record("zd6105-record",
    zone_id = zone.id,
    name = "example",
    value = "192.0.2.2",
    type = "A",
    ttl = 3600,
)

and requirements.txt as:

pulumi>=3.0.0,<4.0.0
pulumi_cloudflare==5.43.1

The change is not applied to the record. I even have Pulumi detecting that the change still needs to be applied at every pulumi up:

$ pulumi up     
Previewing update (team-ce/ringo)

View in Browser (Ctrl+O): https://app.pulumi.com/team-ce/6180/ringo/previews/10fa0bc7-63a0-499b-8080-e53d74f9e7ae

     Type                        Name           Plan       Info
     pulumi:pulumi:Stack         6180-ringo                
 ~   └─ cloudflare:index:Record  zd6105-record  update     [diff: ~value]; 1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:ringo::6180::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

    [Pulumi Copilot] Would you like help with these diagnostics?
    https://app.pulumi.com/team-ce/6180/ringo/previews/10fa0bc7-63a0-499b-8080-e53d74f9e7ae?explainFailure

Resources:
    ~ 1 to update
    2 unchanged

Do you want to perform this update? details
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:ringo::6180::pulumi:pulumi:Stack::6180-ringo]
    ~ cloudflare:index/record:Record: (update)
        [id=d38b25f10d66e7d7100f415fd092888e]
        [urn=urn:pulumi:ringo::6180::cloudflare:index/record:Record::zd6105-record]
        [provider=urn:pulumi:ringo::6180::pulumi:providers:cloudflare::default_5_43_1::84d2bbf6-5ce1-4ab8-b0de-d7d1064ea022]
      ~ value: "192.0.2.1" => "192.0.2.2"

Do you want to perform this update? yes
Updating (team-ce/ringo)

View in Browser (Ctrl+O): https://app.pulumi.com/team-ce/6180/ringo/updates/8

     Type                        Name           Status           Info
     pulumi:pulumi:Stack         6180-ringo                      
 ~   └─ cloudflare:index:Record  zd6105-record  updated (4s)     [diff: ~value]; 1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:ringo::6180::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

    [Pulumi Copilot] Would you like help with these diagnostics?
    https://app.pulumi.com/team-ce/6180/ringo/updates/8?explainFailure

Resources:
    ~ 1 updated
    2 unchanged

Duration: 9s

$ pulumi up
Previewing update (team-ce/ringo)

View in Browser (Ctrl+O): https://app.pulumi.com/team-ce/6180/ringo/previews/1f36a68f-a351-419c-b181-dfdfa0e6ee91

     Type                        Name           Plan       Info
     pulumi:pulumi:Stack         6180-ringo                
 ~   └─ cloudflare:index:Record  zd6105-record  update     [diff: ~value]; 1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:ringo::6180::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

    [Pulumi Copilot] Would you like help with these diagnostics?
    https://app.pulumi.com/team-ce/6180/ringo/previews/1f36a68f-a351-419c-b181-dfdfa0e6ee91?explainFailure

Resources:
    ~ 1 to update
    2 unchanged

Do you want to perform this update? details
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:ringo::6180::pulumi:pulumi:Stack::6180-ringo]
    ~ cloudflare:index/record:Record: (update)
        [id=d38b25f10d66e7d7100f415fd092888e]
        [urn=urn:pulumi:ringo::6180::cloudflare:index/record:Record::zd6105-record]
        [provider=urn:pulumi:ringo::6180::pulumi:providers:cloudflare::default_5_43_1::84d2bbf6-5ce1-4ab8-b0de-d7d1064ea022]
      ~ value: "192.0.2.1" => "192.0.2.2"

Do you want to perform this update? yes
Updating (team-ce/ringo)

View in Browser (Ctrl+O): https://app.pulumi.com/team-ce/6180/ringo/updates/9

     Type                        Name           Status           Info
     pulumi:pulumi:Stack         6180-ringo                      
 ~   └─ cloudflare:index:Record  zd6105-record  updated (4s)     [diff: ~value]; 1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:ringo::6180::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

    [Pulumi Copilot] Would you like help with these diagnostics?
    https://app.pulumi.com/team-ce/6180/ringo/updates/9?explainFailure

Resources:
    ~ 1 updated
    2 unchanged

Duration: 8s

--

pulumi about:

CLI          
Version      3.142.0
Go Version   go1.23.3
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  cloudflare  5.43.1
language  python      unknown

Host     
OS       darwin
Version  15.1.1
Arch     arm64

This project is written in python: executable='/Users/ringods/Projects/pulumi-customers/customer-engineering/customer-support/6180/venv/bin/python' version='3.13.0'

Current Stack: team-ce/6180/ringo


Found no pending operations associated with team-ce/ringo

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/v-ringo-pulumi-corp
User           v-ringo-pulumi-corp
Organizations  v-ringo-pulumi-corp, team-ce, demo, pulumi
Token type     personal

Dependencies:
NAME               VERSION
pip                24.3.1
pulumi_cloudflare  5.43.1
setuptools         75.6.0
wheel              0.45.1

Pulumi locates its logs in /var/folders/yq/10j1hf8s1ks9f23yxrdbbbb40000gn/T/ by default

@guineveresaenger
Copy link
Contributor

guineveresaenger commented Dec 7, 2024

Hi @ringods - I looked into this today and...I cannot reproduce this behavior with your example.

A few notes, in case I'm doing something differently without realizing (I'm not fluent in Python anymore):

  1. pulumi new python
  2. copy your code into __main.py__
  3. copy your requirements.txt
  4. run venv/bin/pip install -r requirements.txt
  5. `pulumi config set --secret (accountID)
  6. using email and api key as env vars because I couldn't get them to work when setting in Pulumi.dev.yaml
  7. pulumi up
  8. log into cloudflare account; verify the Zone exists and has the Record
  9. change the record in my program
  10. run pulumi up
  11. see the record has been updated in the console; pulumi up shows no diff.

Pulumi output:

guin cloudflare-952/python-cloudflare-952🦉 pulumi up                             
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/guinevere-pulumi-corp/python-cloudflare-952/dev/previews/670dac61-b43f-476f-8123-49e40f0352cf

     Type                        Name                       Plan       Info
 +   pulumi:pulumi:Stack         python-cloudflare-952-dev  create     
 +   ├─ cloudflare:index:Zone    zd6105-zone                create     
 +   └─ cloudflare:index:Record  zd6105-record              create     1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:dev::python-cloudflare-952::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

Resources:
    + 3 to create

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

View in Browser (Ctrl+O): https://app.pulumi.com/guinevere-pulumi-corp/python-cloudflare-952/dev/updates/1

     Type                        Name                       Status              Info
 +   pulumi:pulumi:Stack         python-cloudflare-952-dev  created (4s)        
 +   ├─ cloudflare:index:Zone    zd6105-zone                created (2s)        
 +   └─ cloudflare:index:Record  zd6105-record              created (0.49s)     1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:dev::python-cloudflare-952::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

Resources:
    + 3 created

Duration: 5s

guin cloudflare-952/python-cloudflare-952🦉 pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/guinevere-pulumi-corp/python-cloudflare-952/dev/previews/7afc2819-70b8-406f-8771-20a153fdc5c1

     Type                        Name                       Plan       Info
     pulumi:pulumi:Stack         python-cloudflare-952-dev             
 ~   └─ cloudflare:index:Record  zd6105-record              update     [diff: ~value]; 1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:dev::python-cloudflare-952::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

Resources:
    ~ 1 to update
    2 unchanged

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

View in Browser (Ctrl+O): https://app.pulumi.com/guinevere-pulumi-corp/python-cloudflare-952/dev/updates/2

     Type                        Name                       Status              Info
     pulumi:pulumi:Stack         python-cloudflare-952-dev                      
 ~   └─ cloudflare:index:Record  zd6105-record              updated (0.68s)     [diff: ~value]; 1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:dev::python-cloudflare-952::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

Resources:
    ~ 1 updated
    2 unchanged

Duration: 2s

guin cloudflare-952/python-cloudflare-952🦉 pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/guinevere-pulumi-corp/python-cloudflare-952/dev/previews/79c799b8-d291-4899-ad9c-a6d36b1a2cd9

     Type                        Name                       Plan     Info
     pulumi:pulumi:Stack         python-cloudflare-952-dev           
     └─ cloudflare:index:Record  zd6105-record                       1 warning

Diagnostics:
  cloudflare:index:Record (zd6105-record):
    warning: urn:pulumi:dev::python-cloudflare-952::cloudflare:index/record:Record::zd6105-record verification warning: `value` is deprecated in favour of `content` and will be removed in the next major release.

Resources:
    3 unchanged

Do you want to perform this update? no
confirmation declined, not proceeding with the update

--

pulumi about:

guin cloudflare-952/python-cloudflare-952🦉 pulumi about
CLI          
Version      3.142.0
Go Version   go1.23.3
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  cloudflare  5.43.1
language  python      3.142.0

Host     
OS       darwin
Version  13.5
Arch     arm64

This project is written in python: executable='/Users/guin/go/src/github.com/pulumi/repros/cloudflare-952/python-cloudflare-952/venv/bin/python' version='3.12.6'

Current Stack: guinevere-pulumi-corp/python-cloudflare-952/dev

TYPE                            URN
pulumi:pulumi:Stack             urn:pulumi:dev::python-cloudflare-952::pulumi:pulumi:Stack::python-cloudflare-952-dev
pulumi:providers:cloudflare     urn:pulumi:dev::python-cloudflare-952::pulumi:providers:cloudflare::default_5_43_1
cloudflare:index/zone:Zone      urn:pulumi:dev::python-cloudflare-952::cloudflare:index/zone:Zone::zd6105-zone
cloudflare:index/record:Record  urn:pulumi:dev::python-cloudflare-952::cloudflare:index/record:Record::zd6105-record


Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/guinevere-pulumi-corp
User           guinevere-pulumi-corp
Organizations  guinevere-pulumi-corp, pulumi
Token type     personal

Dependencies:
NAME               VERSION
pip                24.3.1
pulumi_cloudflare  5.43.1
setuptools         75.6.0
wheel              0.45.1

Pulumi locates its logs in /var/folders/87/6b426tw97kl6vb55pl6nbzym0000gn/T/ by default

The one thing that gives me pause here is that the zone is officially Pending on Cloudflare since there are a few missing steps to make this test program a "real" zone: https://developers.cloudflare.com/dns/zone-setups/reference/domain-status/#pending

Image

The fact that zones can be in Pending state makes me wonder if Cloudflare itself denies updates when zones are in certain states.

@guineveresaenger
Copy link
Contributor

Since we have no reliable repro for this bug, I've opened #1015 to make the deprecation warning a little stronger.

In the meantime, for anyone encountering this issue, the path forward here seems to be to use the new content field - please report if that shows similar bad behavior.

@guineveresaenger guineveresaenger removed their assignment Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-feedback Blocked on input from the author kind/bug Some behavior is incorrect or out of spec needs-repro Needs repro steps before it can be triaged or fixed
Projects
None yet
Development

No branches or pull requests

5 participants