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

Unable to set defaultTags via CLI #2663

Closed
Tracked by #2539
t0yv0 opened this issue Aug 2, 2023 · 4 comments
Closed
Tracked by #2539

Unable to set defaultTags via CLI #2663

t0yv0 opened this issue Aug 2, 2023 · 4 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed
Milestone

Comments

@t0yv0
Copy link
Member

t0yv0 commented Aug 2, 2023

What happened?

Unable to set defaultTags provider setting for the default provider using Pulumi CLI.

Expected Behavior

There should be some easy way set the default tags.

Steps to reproduce

$ pulumi new aws-typescript
$ pulumi config  set --path 'aws:defaultTags["name"]' 'thename'

$ pulumi config
KEY              VALUE
aws:defaultTags  {"name":"thename"}
aws:region       us-east-1

$ pulumi config --json                                                                                                                                                     ~/tmp/2023/08/aws-deftags
{
  "aws:defaultTags": {
    "value": "{\"name\":\"thename\"}",
    "objectValue": {
      "name": "thename"
    },
    "secret": false
  },
  "aws:region": {
    "value": "us-east-1",
    "secret": false
  }
}


$ pulumi preview
error: pulumi:providers:aws resource 'default_5_42_0' has a problem: could not validate provider configuration: Invalid or unknown key. Check `pulumi config get --path aws:defaultTags.name`.

$ pulumi config rm aws:defaultTags
$ pulumi config set --path 'aws:default_tags["name"]' 'thename'

$ pulumi config
KEY               VALUE
aws:default_tags  {"name":"thename"}
aws:region        us-east-1

$ pulumi config --json                                                                                                                                                     ~/tmp/2023/08/aws-deftags
{
  "aws:default_tags": {
    "value": "{\"name\":\"thename\"}",
    "objectValue": {
      "name": "thename"
    },
    "secret": false
  },
  "aws:region": {
    "value": "us-east-1",
    "secret": false
  }
}


$ pulumi preview
error: pulumi:providers:aws resource 'default_5_42_0' has a problem: could not validate provider configuration: Expected Object Type. Expected object, got string. Check `pulumi config get --path aws:defaultTags`.

Output of pulumi about

CLI          
Version      3.73.0
Go Version   go1.20.5
Go Compiler  gc

Plugins
NAME    VERSION
aws     5.42.0
awsx    1.0.2
docker  3.6.1
nodejs  unknown

Host     
OS       darwin
Version  13.4.1
Arch     x86_64

This project is written in nodejs: executable='/Users/t0yv0/.nix-profile/bin/node' version='v18.16.1'

Current Stack: t0yv0/ts-deftags/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/t0yv0
User           t0yv0
Organizations  t0yv0, pulumi

Dependencies:
NAME            VERSION
@pulumi/awsx    1.0.2
@pulumi/pulumi  3.76.1
@types/node     16.18.39
@pulumi/aws     5.42.0

Pulumi locates its logs in /var/folders/gk/cchgxh512m72f_dmkcc3d09h0000gp/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).

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Aug 2, 2023
@t0yv0
Copy link
Member Author

t0yv0 commented Aug 2, 2023

I recently did some work in the bridge pertaining to adding "Check pulumi config get --path aws:defaultTags.name" messages could be relevant here:

https://github.com/pulumi/pulumi-terraform-bridge/releases/tag/v3.51.0
https://github.com/pulumi/pulumi-terraform-bridge/releases/tag/v3.49.0

@t0yv0
Copy link
Member Author

t0yv0 commented Aug 2, 2023

[255] t0yv0@Antons-MacBook-Pro> npm i @pulumi/[email protected]                                                                                                                                          ~/tmp/2023/08/aws-deftags

changed 1 package, and audited 220 packages in 3s

68 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
t0yv0@Antons-MacBook-Pro> pulumi preview                                                                                                                                                           ~/tmp/2023/08/aws-deftags
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/t0yv0/ts-deftags/dev/previews/49eab0d2-f326-4c7f-b804-aa4de8625a2f

     Type                 Name            Plan       Info
 +   pulumi:pulumi:Stack  ts-deftags-dev  create     
     └─ aws:s3:Bucket     my-bucket                  1 error


Diagnostics:
  aws:s3:Bucket (my-bucket):
    error: could not validate provider configuration: 1 error occurred:
        * Invalid or unknown key


[255] t0yv0@Antons-MacBook-Pro> npm i @pulumi/[email protected]                                                                                                                                          ~/tmp/2023/08/aws-deftags

changed 1 package, and audited 220 packages in 2s

68 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
t0yv0@Antons-MacBook-Pro> pulumi preview                                                                                                                                                           ~/tmp/2023/08/aws-deftags
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/t0yv0/ts-deftags/dev/previews/475857ac-46e7-4327-8891-5ef685ba551d

     Type                     Name            Plan       Info
 +   pulumi:pulumi:Stack      ts-deftags-dev  create     
     └─ pulumi:providers:aws  default_5_38_0             1 error


Diagnostics:
  pulumi:providers:aws (default_5_38_0):
    error: rpc error: code = Unknown desc = could not validate provider configuration: 1 error occurred:
        * Expected Object Type: Expected object, got string

This changed from 5.37 to 5.38 but technically not a regression, didn't work in the first place.

@iwahbe
Copy link
Member

iwahbe commented Aug 2, 2023

Try $ pulumi config set --path 'aws:defaultTags.tags["name"]' 'thename'

This is how https://www.pulumi.com/registry/packages/aws/api-docs/provider/#providerdefaulttags describes the format.

@t0yv0
Copy link
Member Author

t0yv0 commented Aug 3, 2023

That was it! Thanks, this works.

@t0yv0 t0yv0 added resolution/by-design This issue won't be fixed because the functionality is working as designed and removed needs-triage Needs attention from the triage team labels Aug 3, 2023
@t0yv0 t0yv0 closed this as completed Aug 3, 2023
@t0yv0 t0yv0 added this to the 0.92 milestone Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed
Projects
None yet
Development

No branches or pull requests

2 participants