https://pulumi.com logo
#general
Title
# general
c

creamy-monkey-35142

03/08/2024, 3:07 AM
Hi there, I’m trying to get Pulumi config from Python code, if use
Copy code
pulumi_config = pulumi.Config()
Config = pulumi_config.get_object("Internal")
it return values as json as epxected but if use
Copy code
Config = pulumi_config.require_object("Internal")
it return
Copy code
error: Exception calling application: Missing required configuration variable 'project:Internal'
        please set a value using the command `pulumi config set project:Internal <value>`
it’s not my expectation. do you guys have any ideas to fix it? Here is the content of file Pulumi.Internal.yaml
Copy code
encryptionsalt: v1:7mw2Wakj9JI=:v1:<xxxxxxxxx>
config:
  pulum:Internal:
    url: <https://example.com>
oh due to of `pulumi.Config()`function
:param str name: The configuration bag’s logical name that uniquely identifies it. If not provided, the name
of the current project is used.
because of I’m using dynamic provider, so `project`in error above is the name of Dynamic provider that I’m working on
c

cuddly-computer-18851

03/08/2024, 6:25 AM
project
should be whatever name you have set in your Pulumi.yaml file
c

creamy-monkey-35142

03/08/2024, 6:47 AM
The problem is I’m working on Dynamic Resource provider, when I call `pulumi.Config()`it’ll return value of pulum:Internal in yaml file. buet when I call it from class
class ProjectProvider(ResourceProvider)
, it’ll get value from
project:Internal
. I also tried to add pulumi.Config(name=‘pulum’) but not work
Copy code
class Project(Resource)
    def __init__(self, name: str, args: ProjectInputs, opts: Optional[ResourceOptions] = None):
        super().__init__(ProjectProvider(), name, {**vars(args)}, opts)
the context is I want get the apiToken in config and pass it into Dynamic resource provider to make request while creating resource
oh, is’a a bug