https://pulumi.com logo
Docs
Join the conversationJoin Slack
Channels
announcements
automation-api
aws
azure
blog-posts
built-with-pulumi
cloudengineering
cloudengineering-support
content-share
contribex
contribute
docs
dotnet
finops
general
getting-started
gitlab
golang
google-cloud
hackathon-03-19-2020
hacktoberfest
install
java
jobs
kubernetes
learn-pulumi-events
linen
localstack
multi-language-hackathon
office-hours
oracle-cloud-infrastructure
plugin-framework
pulumi-cdk
pulumi-crosscode
pulumi-deployments
pulumi-kubernetes-operator
pulumi-service
pulumiverse
python
registry
status
testingtesting123
testingtesting321
typescript
welcome
workshops
yaml
Powered by Linen
getting-started
  • c

    clever-glass-42863

    04/04/2022, 9:57 PM
    What's the best way to handle passing custom arguments from the
    pulumi up
    command into the dotnet Program itself? Are all the extra command line arguments passed through passively? Or will we need to do something else to do that; for example just rely on environment variables.
    internal class Program
        {
            static Task<int> Main() 
            {
                // I want to parse command-line args here, but does pulumi up pass them through?
                // Or just use Environment variables?
                return Deployment.RunAsync<MyCoolStack>();
            }
        }
    b
    • 2
    • 2
  • q

    quick-wolf-8403

    04/05/2022, 4:54 PM
    Hi folks! Is there a way to integrate one's Pulumi dependencies into the service it configures? For example, I manage a collection of Node services, with my pulumi project code in another repo from the Node Code. That works fine, but means I need to do tasks like add secrets or env vars to the services. I'd love to enable other developers to add these when they need them. Can I 1. Integrate the pulumi project code into the build process of the services, adding its dependencies to
    package.json
    etc, having
    pulumi up
    in an 'npm run' script? 2. Or, am I best just having it exist in a subdirectory and forcing devs to set up the dependencies (npm i again in the subdir, or a Python venv, or install Go, etc) What's possible, and what's the best practice?
    b
    • 2
    • 2
  • h

    happy-exabyte-28607

    04/05/2022, 6:31 PM
    hi All, x=pulumi.FileArchive("./main.zip") # create lambda function lambda_function = lambda_.Function( "name", description="cleanup data", code=x, role=role_for_lambda.arn, handler="handler", runtime="go1.x") stderr: error: unexpected Asset Archive property value for "code"
    ✅ 1
    b
    • 2
    • 3
  • h

    happy-exabyte-28607

    04/05/2022, 6:32 PM
    can somebody point out what is wrong here
  • c

    chilly-plastic-75584

    04/05/2022, 6:41 PM
    Is there a flag I can set to force server side comparison for Kubernetes? I want to do a diff but I want to ensure it's aligned with reality in case of a failed/timed out deployment. I would then output this diff to PR/job/slack so it could be reviewed prior to the job actually running the apply.
  • r

    rough-oyster-77458

    04/05/2022, 7:11 PM
    Hi, I want to change a schema in my Bigquery table. I know that it should be deleted and I'm ok with it. I changed the schema and when I run
    pulumi up
    , I see this error message:
    error: deleting urn:pulumi:dev::data::gcp:bigquery/dataset:Dataset$gcp:bigquery/table:Table::my_dataset.my_table: 1 error occurred:
            * cannot destroy instance without setting deletion_protection=false and running `terraform apply`
    I changes some resource options:
    opts=pl.ResourceOptions(
            parent=dataset_raw,
            delete_before_replace=True,
            protect=False,
        )
    But the error has not been dissapeared. What did I do wrong? How to fix that?
    s
    b
    • 3
    • 12
  • g

    gifted-answer-39386

    04/06/2022, 1:34 PM
    Hi all, I'm trying to import my existing resources in
    aws
    using
    aws-native
    package. I have successfully imported a single resource (s3 bucket), but it was imported without the
    PublicAccessBlockConfiguration
    . My infra was created using
    cloudformation
    , so I would like keep the same syntax and API. How can I import my resources using
    aws-native
    ?
    b
    • 2
    • 1
  • c

    chilly-plastic-75584

    04/06/2022, 6:32 PM
    Any solid use case for using pulumi for docker build? Considering I'm not using automation API and running on agents wondering what gain using pulumi for a build oriented action offers instead of doing that via docker CLI directly or using ko/go-releaser etc
    g
    • 2
    • 1
  • s

    stocky-butcher-62635

    04/07/2022, 8:19 AM
    Docker? I thought this was something to do with configuring things in Azure?
    b
    • 2
    • 1
  • s

    stocky-butcher-62635

    04/07/2022, 9:02 AM
    So I know that I can click around in Azure Portal to make things. Is the idea that this scripts that up?
    b
    • 2
    • 1
  • s

    stocky-butcher-62635

    04/07/2022, 9:45 AM
    Is this right?
    > az login
    A web browser has been opened at <https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize>. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
    [
      {
        "cloudName": "AzureCloud",
        "homeTenantId": "...",
        "id": "...",
        "isDefault": true,
        "managedByTenants": [],
        "name": "Azure Subscription",
        "state": "Enabled",
        "tenantId": "...",
        "user": {
          "name": "richardb@...",
          "type": "user"
        }
      }
    ]
    
    > pulumi login
    Logged in to <http://pulumi.com|pulumi.com> as ... (<https://app.pulumi.com/...>)
    warning: A new version of Pulumi is available. To upgrade from version '3.27.0' to '3.28.0', run
       > powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('<https://get.pulumi.com/install.ps1'))>"
    or visit <https://pulumi.com/docs/reference/install/> for manual instructions and release notes.
    
    > mkdir Pulumi
    > cd Pulumi
    > pulumi new csharp
    This command will walk you through creating a new Pulumi project.
    
    Enter a value or leave blank to accept the (default), and press <ENTER>.
    Press ^C at any time to quit.
    
    project name: (Pulumi2) RwbTestProject
    project description: (A minimal C# Pulumi program) RWB's test project
    Created project 'RwbTestProject'
    
    Please enter your desired stack name.
    To create a stack in an organization, use the format <org-name>/<stack-name> (e.g. `acmecorp/dev`).
    stack name: (dev) rwb-test-stack
    Created stack 'rwb-test-stack'
    
    Installing dependencies...
    
    running 'dotnet build -nologo .'
      Determining projects to restore...
    
      Restored C:\Work\Pulumi\RwbTestProject.csproj (in 1.5 sec).
    
      RwbTestProject -> C:\Work\Pulumi\bin\Debug\netcoreapp3.1\RwbTestProject.dll
    
    
    
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:03.23
    
    'dotnet build -nologo .' completed successfully
    Finished installing dependencies
    
    Your new project is ready to go!
    
    To perform an initial deployment, run 'pulumi up'
    
    warning: A new version of Pulumi is available. To upgrade from version '3.27.0' to '3.28.0', run
       > powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('<https://get.pulumi.com/install.ps1'))>"
    or visit <https://pulumi.com/docs/reference/install/> for manual instructions and release notes.
    
    > REM A new thing has now appeared in the Pulumi website.
    b
    • 2
    • 1
  • s

    stocky-butcher-62635

    04/07/2022, 10:00 AM
    There's lots of shit in the website now where I bollocksed it up. Can they be deleted?
    pulumi destroy
    seems to be for stacks not projects? And I deleted the
    yml
    file already.
  • s

    stocky-butcher-62635

    04/07/2022, 10:04 AM
    https://www.pulumi.com/docs/intro/concepts/project/ says that there should be a
    project.stack.yml
    file but there isn't.
  • s

    stocky-butcher-62635

    04/07/2022, 11:08 AM
    and there's only one C# file -- called
    MyStack.cs
    . Presumably there should be one for every stack?
    b
    • 2
    • 1
  • s

    stocky-butcher-62635

    04/07/2022, 11:14 AM
    Is it supposed to be
    pulumi new azure-csharp
    rather than just
    csharp
    ?
  • s

    stocky-butcher-62635

    04/07/2022, 11:23 AM
    Seems that a project disappears if you delete all it's Stacks in the website?
  • s

    stocky-butcher-62635

    04/07/2022, 12:54 PM
    azure-csharp
    does create a
    .stack.yml
    Have to remove any custom NuGet feeds from
    NuGet.conf
    because it only works with
    <http://nuget.org|nuget.org>
  • s

    stocky-butcher-62635

    04/07/2022, 1:57 PM
    Since the C# isn't actually runnable how can I debug it?
  • s

    stocky-butcher-62635

    04/07/2022, 2:00 PM
    if I
    pulumi stack init staging
    then it doesn't add a new yml file. And if I add a yml file then no new pink blob appears in the website
    b
    • 2
    • 1
  • s

    stocky-butcher-62635

    04/07/2022, 2:00 PM
    so how are you supposed to make a new one?
  • s

    stocky-butcher-62635

    04/07/2022, 2:25 PM
    what is the format of the yml file?
  • s

    stocky-butcher-62635

    04/07/2022, 2:25 PM
    what can you put in it? How does it get used?
    b
    • 2
    • 1
  • s

    stocky-butcher-62635

    04/07/2022, 2:51 PM
    Since deployments are triggered from AzureDevOps rather than being done in Azure, does it follow that everything that is deployable should have an associated pulumi project and some mechanism to determine which branch to deploy to which environment (where environment corresponds to a yml file and to a pink blob in the website) and some mechanism to determine whether that deployment is done automatically or needs manual approval to proceed
    b
    • 2
    • 1
  • g

    great-queen-39697

    04/07/2022, 3:09 PM
    Hey @stocky-butcher-62635! I'd love to help you understand Pulumi a bit. Want to hop into this thread, and we'll see if we can help you get sorted out? 🧵 I'm also happy to hop onto a Zoom call to go over how Pulumi works if that would help.
    s
    • 2
    • 10
  • s

    stocky-butcher-62635

    04/08/2022, 8:32 AM
    What does
    *
    mean?
    l
    • 2
    • 10
  • s

    stocky-butcher-62635

    04/08/2022, 3:26 PM
    I added this to the
    yml
    file for the environment
    RwbPulumiProject:ApplicationName: rwb
    (Apparently each setting key must be of the form
    a:b
    The documentation page https://www.pulumi.com/docs/intro/concepts/config/ implies that the first bit is not required but apparently this is untrue.) Then I try to use it
    Config config = new Pulumi.Config();
            string applicationName = config.Require("RwbPulumiProject:ApplicationName");
    (Is is possible to rename the class from
    MyStack
    ? My* really makes my skin crawl.) But then
    C:\Work\Azure\RwbPulumiProject>pulumi up
    Previewing update (dev)
    
    View Live: <https://app.pulumi.com/jayallcock/RwbPulumiProject/dev/previews/a321fb21-a32a-4b5d-bd30-61c0e6e68c94>
    
         Type                 Name                  Plan       Info
     +   pulumi:pulumi:Stack  RwbPulumiProject-dev  create     1 error
    
    Diagnostics:
      pulumi:pulumi:Stack (RwbPulumiProject-dev):
        error: Running program 'C:\Work\Azure\RwbPulumiProject\bin\Debug\netcoreapp3.1\RwbPulumiProject.dll' failed with an unhandled exception:
        System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
           at object RuntimeTypeHandle.CreateInstance(RuntimeType type, bool publicOnly, bool wrapExceptions, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool hasNoDefaultCtor)
           at object RuntimeType.CreateInstanceDefaultCtorSlow(bool publicOnly, bool wrapExceptions, bool fillCache)
           at object RuntimeType.CreateInstanceDefaultCtor(bool publicOnly, bool skipCheckThis, bool fillCache, bool wrapExceptions)
           at T Activator.CreateInstance<T>()
           at Task<int> Pulumi.Deployment+Runner.Pulumi.IRunner.RunAsync<TStack>(IServiceProvider serviceProvider)+() => { }
           at Task<int> Pulumi.Deployment+Runner.RunAsync<TStack>(Func<TStack> stackFactory) ---> Pulumi.Config+ConfigMissingException: Missing Required configuration variable 'RwbPulumiProject:RwbPulumiProject:ApplicationName'
            please set a value using the command `pulumi config set RwbPulumiProject:RwbPulumiProject:ApplicationName <value>`
           at string Pulumi.Config.RequireImpl(string key, string use, string insteadOf)
           at string Pulumi.Config.Require(string key)
           at new MyStack() in C:/Work/Azure/RwbPulumiProject/MyStack.cs:line 17
           --- End of inner exception stack trace ---
    
    
    
    C:\Work\Azure\RwbPulumiProject>
    b
    g
    • 3
    • 8
  • s

    stocky-butcher-62635

    04/08/2022, 3:28 PM
    Or can you not add your own settings? Or is there a special way to define them?
  • s

    stocky-butcher-62635

    04/08/2022, 4:18 PM
    Looks like if an
    up
    fails then it doesn't roll back and you need to go into the Azure website to work out what happened and clean up?
    g
    • 2
    • 3
  • l

    limited-fish-67957

    04/08/2022, 4:32 PM
    hey, one issue I am facing using
    pulumi
    is the my node_modules are not getting uploaded to aws
    lambda
    . I was wondering if anyone has solved this or point me to some kind of solution of uploading the
    node-modules
    as my
    serverless
    function keeps giving me
    module not found error
    g
    • 2
    • 7
  • b

    broad-fall-19241

    04/08/2022, 7:24 PM
    Hey everyone! Running into a funny issue when using the Pulumi Automation API, described below. Background I’m using the Automation API to manage resources on Azure. I created a couple of RunCommands and Custom Script Virtual Machine Extension resources, but the
    up
    got interrupted (can’t recall if it was a network error or if I cancelled w/
    Ctrl + C
    ). This, of course, left some
    pending_operations
    in the state that prevent the use of
    up
    ,
    down
    , etc. Solution Attempt I tried to solve this the usual way, viz., by exporting the state; clearing the `pending_operations`; and re-importing it. I’m not certain if I’m doing this right, as I wasn’t able to find much documentation on this, but this is how that’s happening:
    # EXPORT STATE
    # ############
    print('Exporting deployment...')
    stack_data = stack.workspace.export_stack(stack_name)
    with open('stack.json', 'w+') as output:
      output.write(str(stack_data))
    print('Deployment exported.')
    I then modify the
    stack.json
    to remove
    pending_operations
    , and attempt to re-import:
    # IMPORT STATE
    # ############
    print('Importing deployment...')
    with open('stack.json', 'r') as stack_data:
      deployment = auto._workspace.Deployment(deployment=stack_data.read())
      stack.workspace.import_stack(stack_name, deployment)
    print('Deployment imported.')
    Expected Behavior I’d expect to see output analogous to that produced by the CLI in this circumstance, namely:
    # From: <https://www.pulumi.com/docs/troubleshooting/>
    $ pulumi stack export | pulumi stack import
    warning: removing pending operation 'creating' on '...' from snapshot
    Import successful.
    Issue Instead, I get the following, fairly confusing error:
    File "/Users/{SCRUBBED}/env/lib/python3.10/site-packages/pulumi/automation/_cmd.py", line 78, in _run_pulumi_cmd
        raise create_command_error(result)
    pulumi.automation.errors.CommandError:
     code: 255
     stdout:
     stderr: error: the stack 'dev-3' is too old to be used by this version of the Pulumi CLI
    I upgraded the CLI, the
    pulumi
    package, and attempted re-importing an unmodified state file (i.e., export and immediately import, without making changes to
    pending_operations
    ), to no avail. I’m not sure where to look for information on the error code or where this comes from, and I found no hints after examining the source. Any input would be much appreciated — I’d rather not tear down the stack out-of-band just to recreate it (and maybe hit the same issue anyway). Thanks in advance!
    g
    • 2
    • 3
Powered by Linen
Title
b

broad-fall-19241

04/08/2022, 7:24 PM
Hey everyone! Running into a funny issue when using the Pulumi Automation API, described below. Background I’m using the Automation API to manage resources on Azure. I created a couple of RunCommands and Custom Script Virtual Machine Extension resources, but the
up
got interrupted (can’t recall if it was a network error or if I cancelled w/
Ctrl + C
). This, of course, left some
pending_operations
in the state that prevent the use of
up
,
down
, etc. Solution Attempt I tried to solve this the usual way, viz., by exporting the state; clearing the `pending_operations`; and re-importing it. I’m not certain if I’m doing this right, as I wasn’t able to find much documentation on this, but this is how that’s happening:
# EXPORT STATE
# ############
print('Exporting deployment...')
stack_data = stack.workspace.export_stack(stack_name)
with open('stack.json', 'w+') as output:
  output.write(str(stack_data))
print('Deployment exported.')
I then modify the
stack.json
to remove
pending_operations
, and attempt to re-import:
# IMPORT STATE
# ############
print('Importing deployment...')
with open('stack.json', 'r') as stack_data:
  deployment = auto._workspace.Deployment(deployment=stack_data.read())
  stack.workspace.import_stack(stack_name, deployment)
print('Deployment imported.')
Expected Behavior I’d expect to see output analogous to that produced by the CLI in this circumstance, namely:
# From: <https://www.pulumi.com/docs/troubleshooting/>
$ pulumi stack export | pulumi stack import
warning: removing pending operation 'creating' on '...' from snapshot
Import successful.
Issue Instead, I get the following, fairly confusing error:
File "/Users/{SCRUBBED}/env/lib/python3.10/site-packages/pulumi/automation/_cmd.py", line 78, in _run_pulumi_cmd
    raise create_command_error(result)
pulumi.automation.errors.CommandError:
 code: 255
 stdout:
 stderr: error: the stack 'dev-3' is too old to be used by this version of the Pulumi CLI
I upgraded the CLI, the
pulumi
package, and attempted re-importing an unmodified state file (i.e., export and immediately import, without making changes to
pending_operations
), to no avail. I’m not sure where to look for information on the error code or where this comes from, and I found no hints after examining the source. Any input would be much appreciated — I’d rather not tear down the stack out-of-band just to recreate it (and maybe hit the same issue anyway). Thanks in advance!
g

great-queen-39697

04/08/2022, 8:50 PM
First, regarding the state/pending operations issue, I'm going to leave this note here in case you might like to vote or comment on the issue in it: https://pulumi-community.slack.com/archives/C019YSXN04B/p1646238520774459?thread_ts=1646144559.200289&amp;cid=C019YSXN04B Regarding the version error, are you running this all on the same machine? Generally I'll find that when the up was run on a machine that was using older versions of either the CLI or the providers that it's calling originally, and then there's a mismatch of versions when it's attempting to run as the versions used are also stored in the state file. Overall, to get more debugging info, the exact flags that you want depends on whether any providers you're using are using the Terraform bridge. But here's a short snippet that should get you all of the diagnostic data that's possible if you can run it locally:
TF_LOG=TRACE pulumi up -v=11 --logflow --logtostderr 2>&1 | tee -a pulumi_log.txt
b

broad-fall-19241

04/10/2022, 2:03 AM
This helped a great deal, was able to solve the issue by mimicking the first Go example you linked. I’ll write up the solution step(s) a bit later, as there were a few peculiarities and opportunities for updating the docs a bit. Meantime, just wanted to say thanks, resolved!
🙌 1
g

great-queen-39697

04/12/2022, 3:15 PM
We'd love a PR for the docs if you're so inclined, too!
View count: 6