pulumi / registry

The global index of everything you can do with Pulumi.
https://www.pulumi.com/registry
Apache License 2.0
27 stars 119 forks source link

DNSimple Static Config Ignored in dotnet #5043

Open drusellers opened 4 months ago

drusellers commented 4 months ago

What happened?

I was starting my Pulumi adventure and wanted to see if I could automate some DNS stuff in DNSimple. Because I'm just starting I didn't really want to muck around with ENV VAR so I thought I could use some kind of static configuration. I found Pulumi.DNSimple.Config and thought I could set those values. Alas, they weren't respected and had to revert to ENV VAR.

Example

using Pulumi;
using Pulumi.DNSimple;

return await Deployment.RunAsync(() =>
{
    Pulumi.DNSimple.Config.Account = "000000";
    Pulumi.DNSimple.Config.Token = "dnsimple_u_....";

    var record = new ZoneRecord("test-record", new ZoneRecordArgs()
    {
        Name = "pulumi",
        Type = "TXT",
        Value = "Hello",
        ZoneName = "twosix.io",
    });
});

Output of pulumi about

❯ pulumi about
running 'dotnet build -nologo .'
  Determining projects to restore...

  All projects are up-to-date for restore.

  groundwork -> /Users/drusellers/dev/altas/groundwork/bin/Debug/net6.0/groundwork.dll

Build succeeded.

    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.07

'dotnet build -nologo .' completed successfully
CLI
Version      3.127.0
Go Version   go1.22.5
Go Compiler  gc

Plugins
KIND      NAME      VERSION
resource  aws       6.47.0
resource  dnsimple  4.0.0
language  dotnet    unknown

Host
OS       darwin
Version  14.5
Arch     arm64

This project is written in dotnet: executable='/usr/local/share/dotnet/dotnet' version='8.0.201'

Current Stack: drusellers/groundwork/dev

TYPE                                  URN
pulumi:pulumi:Stack                   urn:pulumi:dev::groundwork::pulumi:pulumi:Stack::groundwork-dev
pulumi:providers:dnsimple             urn:pulumi:dev::groundwork::pulumi:providers:dnsimple::default_4_0_0
dnsimple:index/zoneRecord:ZoneRecord  urn:pulumi:dev::groundwork::dnsimple:index/zoneRecord:ZoneRecord::test-record

Found no pending operations associated with dev

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

Dependencies:
NAME             VERSION
Pulumi           3.65.0
Pulumi.Aws       6.47.0
Pulumi.DNSimple  4.0.0

Pulumi locates its logs in /var/folders/_c/6jq351xs0s7_drpbxpph56y00000gn/T/ by default

Additional context

I think that is everything.

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).

thoward commented 4 months ago

Could you provide more context, like an error message or some more detail on what you expected vs what happened?

drusellers commented 4 months ago
❯ pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/drusellers/groundwork/dev/previews/494be034-eb37-4586-9062-cfd21c2fac1c

     Type                          Name            Plan     Info
     pulumi:pulumi:Stack           groundwork-dev
     └─ dnsimple:index:ZoneRecord  test-record              1 error

Diagnostics:
  dnsimple:index:ZoneRecord (test-record):
    error: must provide api token: must define a token for the dnsimple provider or set the DNSIMPLE_TOKEN environment variable

but it works with

❯ DNSIMPLE_ACCOUNT=... DNSIMPLE_TOKEN=... pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/drusellers/groundwork/dev/previews/22ce627e-29b5-48b2-95e1-f1dbcd23860a

     Type                 Name            Plan
     pulumi:pulumi:Stack  groundwork-dev

Resources:
    2 unchanged

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

View in Browser (Ctrl+O): https://app.pulumi.com/drusellers/groundwork/dev/updates/2

     Type                 Name            Status
     pulumi:pulumi:Stack  groundwork-dev

Resources:
    2 unchanged

Duration: 1s

I think its odd that the static configuration isn't being respected. The classes are using Pulumi.Config under the covers.

guineveresaenger commented 4 weeks ago

hi @drusellers - I just happened across this issue.

We're sorry you were having trouble here. We've since updated the landing page for dnsimple, which should show you an example of how to set up configuration via Pulumi.yaml configuration file. Read more about configuration here: https://www.pulumi.com/docs/iac/concepts/config/