Hello, could some give advice for a new user of Pu...
# automation-api
s
Hello, could some give advice for a new user of Pulumi automation api. I am trying connect to Pagerduty with pulumi, but I get error - "401 Unauthorized". This is my simple code:
Copy code
def create_user():
    example = pagerduty.User("example_pulumi", email="<mailto:125.pulumi.earline@graham.name|125.pulumi.earline@graham.name>")

def create():
    stack_name = auto.fully_qualified_stack_name(PULUMI_ORG_NAME, PULUMI_PROJECT_NAME, PULUMI_STACK_NAME)

    stack = auto.create_or_select_stack(
        stack_name=stack_name,
        project_name=PULUMI_PROJECT_NAME,
        program=create_user
    )

    stack.set_config("pagerduty:token", auto.ConfigValue(value="pagerduty_token"))

    stack.refresh(on_output=print)
    up_res = stack.up(on_output=print)

create()
and that is error pulumi. I am using the same pagerduty access token with terraform and it works. So I think that there might be something bad with code. Thanks for your help!!
m
Hi. cam you try to get the token via environment variable? Just to see that it work without the usage of the config
r
From your code it looks like you're setting the token to the string "pagerduty_token" which is probably not a valid token? Unless that is a simplification.
s
Hi! sorryt for late response. I have found what was wrong. For testing purposes i have created a trial pagerduty account. And my trial finished. That was the reason for error 🙂 Thanks for your notes and advices!
m
Awesome! Happy continue coding Kepal!