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
general
  • f

    full-bear-42554

    11/12/2020, 7:48 PM
    Pulumi is reporting a strange project ID when I run
    pulumi up
    . I've configured Pulumi to use service account credentials with GCP, but it errors reporting
    * Error when reading or editing Instance 1214816920423977412: googleapi: Error 403: Compute Engine API has not been used in project 349729176759 before or it is disabled. Enable it by visiting <https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=349729176759> then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured
  • f

    full-bear-42554

    11/12/2020, 7:50 PM
    I'm trying to import a pre-existing Compute Engine instance.
  • f

    full-bear-42554

    11/12/2020, 7:55 PM
    For summary information: https://github.com/pulumi/pulumi/issues/5746#issuecomment-726305096 .
  • b

    billowy-army-68599

    11/12/2020, 8:15 PM
    @full-bear-42554 is everything working now?
  • f

    full-bear-42554

    11/12/2020, 9:05 PM
    Hey @billowy-army-68599 I'm stuck trying to get the definition in
    main.go
    (my program) to match the version in GCP.
  • f

    full-bear-42554

    11/12/2020, 9:05 PM
    Do you want to perform this update? details
    + pulumi:pulumi:Stack: (create)
        [urn=urn:pulumi:dev::webbie::pulumi:pulumi:Stack::webbie-dev]
        = gcp:compute/instance:Instance: (import)
            [id=projects/webbie-295322/zones/us-west1-a/instances/webbie]
            [urn=urn:pulumi:dev::webbie::gcp:compute/instance:Instance::mr. webbie]
          - serviceAccount: {
              - email : "<mailto:1038906272696-compute@developer.gserviceaccount.com|1038906272696-compute@developer.gserviceaccount.com>"
              - scopes: [
              -     [0]: "<https://www.googleapis.com/auth/devstorage.read_only>"
              -     [1]: "<https://www.googleapis.com/auth/logging.write>"
              -     [2]: "<https://www.googleapis.com/auth/service.management.readonly>"
              -     [3]: "<https://www.googleapis.com/auth/servicecontrol>"
              -     [4]: "<https://www.googleapis.com/auth/trace.append>"
              -     [5]: "<https://www.googleapis.com/auth/monitoring.write>"
                ]
            }
          - tags          : [
          -     [0]: "https-server"
          -     [1]: "http-server"
    g
    • 2
    • 6
  • f

    full-bear-42554

    11/12/2020, 9:06 PM
    Does this mean that I need
    serviceAccount
    and
    tags
    specified in the
    Instance
    specification?
  • f

    full-bear-42554

    11/12/2020, 9:18 PM
    Okay, @billowy-army-68599 @green-school-95910 and @broad-dog-22463 I've managed to get my GCP Compute Engine instance imported!
  • f

    full-bear-42554

    11/12/2020, 9:18 PM
    Thanks for your help.
  • f

    full-bear-42554

    11/12/2020, 9:19 PM
    This was my first foray into pulumi after seeing it on HackerNews earlier this year.
  • f

    full-bear-42554

    11/12/2020, 9:19 PM
    I'll be honest. I had some difficulty figuring out how to import my GCP Compute Engine instance. I would try something, encounter an error, try to figure out what was causing it, and then iterate.
  • f

    full-bear-42554

    11/12/2020, 9:20 PM
    In this case, my final instance specification looks like:
    inst, err := compute.NewInstance(ctx, "mr. webbie", &compute.InstanceArgs{
    			BootDisk: &compute.InstanceBootDiskArgs{
    				InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
    					Image: pulumi.String("debian-cloud/debian-10-buster"),
    					Size:  <http://pulumi.Int|pulumi.Int>(30),
    				},
    			},
    			MachineType: pulumi.String("f1-micro"),
    			Name:        pulumi.String("webbie"),
    			NetworkInterfaces: &compute.InstanceNetworkInterfaceArray{
    				&compute.InstanceNetworkInterfaceArgs{
    					Network: pulumi.String("default"),
    				},
    			},
    			ServiceAccount: compute.InstanceServiceAccountArgs{
    				Email: pulumi.String("<mailto:1038906272696-compute@developer.gserviceaccount.com|1038906272696-compute@developer.gserviceaccount.com>"),
    				Scopes: pulumi.StringArray{
    					pulumi.String("<https://www.googleapis.com/auth/devstorage.read_only>"),
    					pulumi.String("<https://www.googleapis.com/auth/logging.write>"),
    					pulumi.String("<https://www.googleapis.com/auth/service.management.readonly>"),
    					pulumi.String("<https://www.googleapis.com/auth/servicecontrol>"),
    					pulumi.String("<https://www.googleapis.com/auth/trace.append>"),
    					pulumi.String("<https://www.googleapis.com/auth/monitoring.write>"),
    				},
    			},
    			Project: pulumi.String("webbie-295322"),
    			Zone:    pulumi.String("us-west1-a"),
    			Tags: pulumi.StringArray{
    				pulumi.String("https-server"),
    				pulumi.String("http-server"),
    			},
    		},
    			pulumi.Import(pulumi.ID("1214816920423977412")),
    		)
  • f

    full-bear-42554

    11/12/2020, 9:21 PM
    I started with
    inst, err := compute.NewInstance(ctx, "mr. webbie", &compute.InstanceArgs{
    			BootDisk: &compute.InstanceBootDiskArgs{
    				InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
    					Image: pulumi.String("debian-cloud/debian-10-buster"),
    					Size:  <http://pulumi.Int|pulumi.Int>(30),
    				},
    			},
    			MachineType: pulumi.String("f1-micro"),
    			Name:        pulumi.String("webbie"),
    			NetworkInterfaces: &compute.InstanceNetworkInterfaceArray{
    				&compute.InstanceNetworkInterfaceArgs{
    					Network: pulumi.String("default"),
    				},
    			},
    			Project: pulumi.String("webbie-295322"),
    			Zone:    pulumi.String("us-west1-a"),
    		},
    			pulumi.Import(pulumi.ID("1214816920423977412")),
    		)
  • f

    full-bear-42554

    11/12/2020, 9:21 PM
    If you diff those, you'll find that I had to add information about the tags and the email for the service account, along with a bunch of account scopes.
  • f

    full-bear-42554

    11/12/2020, 9:21 PM
    I had no idea that information was necessary, or how to find it on GCP.
  • f

    full-bear-42554

    11/12/2020, 9:22 PM
    Is there a faster way to discover the minimum amount of information necessary for an import/instantiation than iterating like I did?
    g
    b
    • 3
    • 41
  • f

    full-bear-42554

    11/12/2020, 9:24 PM
    Also, now that I've imported my instance. Am I safe to remove the
    Import
    line from my source code? If so, are ther also other lines that I can safely remove?
    l
    • 2
    • 7
  • b

    broad-keyboard-684

    11/12/2020, 9:48 PM
    I'm using pulumi-aws version 1.18. I need to create a kinesis firehose stream. I'm writing in Go. Does anyone know what the types are for each config below? I can't seem to find them.
    _, err = kinesis.NewFirehoseDeliveryStream(ctx, deliveryStreamName, &kinesis.FirehoseDeliveryStreamArgs{
    		Destination: "splunk",
    		S3Configuration: &<WHAT IS THIS>{
    			RoleArn:           firehoseRole.Arn(),
    			BucketArn:         logBucket.Arn(),
    			BufferSize:        10,
    			BufferInterval:    400,
    			CompressionFormat: "GZIP",
    		},
    		SplunkConfiguration: &<WHAT IS THIS>{
    			HecEndpoint:              "<https://http-inputs-mydomain.splunkcloud.com:443>",
    			HecToken:                 "ABC1234-4567-8910-ABCD-ABCDEFGHIJK",
    			HecAcknowledgmentTimeout: 600,
    			HecEndpointType:          "Event",
    			S3BackupMode:             "FailedEventsOnly",
    		},
    	})
    g
    b
    • 3
    • 11
  • b

    breezy-butcher-78604

    11/13/2020, 6:16 AM
    whats the recommended way to manage multiple pulumi accounts/tokens with the CLI? I have a work account currently but would like to also create a personal account for hobby projects etc. A quick skim of the CLI
    --help
    sections doesn't seem to show much. if i run
    pulumi login
    again it doesn't prompt me for a username, just logs me back in to my work account.
    l
    • 2
    • 4
  • l

    limited-island-40412

    11/13/2020, 7:57 AM
    Hey o/ I’m trying to write my stack outputs to variables on azure devops pipelines. The deployment using the devops pulumi task works nice, but after that I run a shell script
    pulumi login
    pulumi stack select dev
    
    echo "##vso[task.setvariable variable=webapp.billingApi]$(pulumi stack output billingApi)"
    and the stack cannot be found. I set the same working directory as in the pulumi task.
    2020-11-12T12:05:15.7625612Z Logged in to xxx as vsts (azblob://***-infrastructure)
    2020-11-12T12:05:16.1752240Z error: no stack named 'dev' found
    2020-11-12T12:05:16.2685326Z error: no stack selected; please use `pulumi stack select` to choose one
    How can I figure out whats wrong? I don’t see any error. Even in verbose output. My state is stored in an azure blob storage container
    l
    • 2
    • 3
  • n

    numerous-artist-1705

    11/13/2020, 9:20 AM
    Is there a way for Pulumi to parse and use Terraform
    tf.json
    files? Or even
    .tf
    ? That could help transitioning by just using the Pulumi CLI referencing existing Terraform code. I appreciate maintaining something that works with the HCL language is a big overhead, but, at least supporting
    tf.json
    should be more trivial. Also, as Pulumi has already
    tf2pulumi
    , probably part of the work of parsing HCL is already there.
    p
    b
    b
    • 4
    • 9
  • a

    able-shampoo-38014

    11/13/2020, 2:23 PM
    👋 hello everyone! We are evaluating Pulumi to migrate from TF and we are running into what should be a trivial issue and probably are missing something obvious. We are using AWS Batch and are trying to create a Job Definition, which requires a template literal to define properties of an ECS container. Inside this we need to reference an ECR repository dynamically in the definition:
    const ecrRepository = new aws.ecr.Repository('batch-services-pulumi', {
      name: 'batch-services-pulumi',
      imageScanningConfiguration: {
        scanOnPush: true,
      },
      imageTagMutability: 'MUTABLE',
    });
    
    const batchJobDefinition = new aws.batch.JobDefinition(
      'image_processor_pulumi',
      {
        name: 'image_processor_job_definition_pulumi',
        retryStrategy: { attempts: 3 },
        timeout: { attemptDurationSeconds: 1200 },
        containerProperties: `{
        "command": [ "blah" ],
        "image": "${ecrRepository.repositoryUrl}",
        "memory": 1024,
        "vcpus": 1,
        "otherprops" ...
    }
    `,
        type: 'container',
      },
      {
        dependsOn: [ecrRepository],
      },
    );
    The template literal is throwing an error when using
    pulumi preview
    error: aws:batch/jobDefinition:JobDefinition resource 'image_processor_pulumi' has a problem: AWS Batch Job container_properties is invalid: Error decoding JSON: invalid character '\n' in string literal
    after debugging, it looks like its applying this value
    {
            "command": [ "blah" ],
            "image": Calling [toString] on an [Output<T>] is not supported.
        To get the value of an Output<T> as an Output<string> consider either:
        1: o.apply(v => `prefix${v}suffix`)
        2: pulumi.interpolate `prefix${v}suffix`
        See <https://pulumi.io/help/outputs> for more details.
        This function may throw in a future version of @pulumi/pulumi.,
            "memory": 1024,
            "vcpus": 1,
            morestuff ...
    }
    we tried to use apply and interpolate to formate and that seems to work outside of the template literal, but not when its applied inside. Any help would be appreciated (this is our last hurdle to get a working POC
    s
    • 2
    • 3
  • r

    red-area-47037

    11/13/2020, 2:43 PM
    quick question, I am looking for a way in Pulumi to extract the current branch at runtime, but couldnt find any documentation on this. As this information is also available in the Pulumi Webfrontend I was hoping that there are APIs available...
    l
    • 2
    • 1
  • c

    curved-summer-41191

    11/13/2020, 6:26 PM
    I have a stack named github and I'm trying to set a config option as
    github:token
    ; it keeps showing up as
    token
    - anything else (foo:bar) will show as such... is this a bug?
    g
    • 2
    • 3
  • d

    dazzling-sundown-39670

    11/13/2020, 9:27 PM
    I just wanna say; using Pulumi is so awesome. I haven't had this much fun working in forever. Cheers Pulumi team
    ❤️ 6
    🚀 1
  • b

    bright-orange-69401

    11/14/2020, 9:10 AM
    Is there a roadmap for full-fledged providers in languages other than Go ? Dynamic Providers are great for quick-n-dirty and small projects, but as I'm trying to implement bigger providers (e.g. AWS products that don't have a TF provider, Snowflake, etc.) and in a clean, open-source fashion... I feel like I firstly need to develop the Terraform provider then the Pulumi wrapper on top of it, which is tedious Would be so epic to code a proper provider with a nice repo structure, all in Python 🐍
    c
    • 2
    • 1
  • b

    bright-orange-69401

    11/14/2020, 9:18 AM
    Also, what is the recommended way to extend an existing Provider with our own Dynamic Provider ? My use-case here is that I'm trying to implement AWS Pinpoint Journeys, and the Pinpoint provider doesn't have them in Terraform... but the Python SDK
    boto3
    definitely has them ! I kinda wonder how I can interact with the
    pulumi_aws.Provider
    instance to share credentials and stuff : should I declare it as a dependency of my
    dynamic.Resource
    ? If so, what should be the link between the
    pulumi_aws.Provider
    and my
    dynamic.Provider
    ? We've achieved some working examples with my team but I'm not quite satisfied with it : most of the time we ended up with unstable stacks and locked states (had to
    pulumi stack export/import
    )
  • r

    rich-alligator-22189

    11/14/2020, 1:38 PM
    Quick question: does Pulumi version v2.13.2 support the deployment of net5.0 framework deployments to Azure?
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0</TargetFramework>
        <Nullable>enable</Nullable>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="Pulumi.Azure" Version="3.*" />
      </ItemGroup>
    </Project>
    b
    t
    • 3
    • 7
  • p

    purple-alarm-70362

    11/14/2020, 4:10 PM
    hello folks, is it possible to export nat_ip from pulumi? I need to setup GCE Instance using pulumi and pass nat_ip to other tools in my build pipeline. I have already tried to achieve it with terraform and stuck with it. I would like to use Type Script together with pulumi. Many thanks in advance for any suggestions!
    r
    • 2
    • 1
  • c

    clean-dentist-2515

    11/14/2020, 5:46 PM
    Docs here https://www.pulumi.com/docs/reference/pkg/digitalocean/sshkey/#inputs say...
    The public key. If this is a file, it can be read using the file interpolation function
    where can I find this "file interpolation function"?
    b
    • 2
    • 9
Powered by Linen
Title
c

clean-dentist-2515

11/14/2020, 5:46 PM
Docs here https://www.pulumi.com/docs/reference/pkg/digitalocean/sshkey/#inputs say...
The public key. If this is a file, it can be read using the file interpolation function
where can I find this "file interpolation function"?
I understood it to mean something built-in to Pulumi so far I just wrote my own code in
___main___.py
to get file contents
(I am 100% new to Pulumi, just writing my first code in it, haven't run anything yet)
b

broad-dog-22463

11/14/2020, 5:50 PM
Yeah unfortunately that isn’t correct :/ you’d have to use file open and file read I will ensure those docs are updated - I’m sorry about that!
c

clean-dentist-2515

11/14/2020, 5:50 PM
no worries, thanks for quick reply 🙂
b

broad-dog-22463

11/14/2020, 5:51 PM
Happy to give you a hint on the code if you are not a python user
c

clean-dentist-2515

11/14/2020, 5:56 PM
I'm experienced with Python the code examples for "look up an existing resource" are not 100% obvious e.g.
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, ...) -> SshKey
raises the question... "staticmethod of what?" I understood this to mean I should do something like:
import pulumi_digitalocean as do

key = do.SshKey.get(...)
slightly confusing because the "create resource" example shows
def SshKey(resource_name: str, opts: Optional[ResourceOptions] = None, name: Optional[str] = None, public_key: Optional[str] = None)
so it looks like
do.SshKey
is a factory function rather than a class I couldn't think of any other way to interpret it though
b

broad-dog-22463

11/14/2020, 6:01 PM
Oh that’s interesting feedback! Would you mind opening an issue about this on GitHub.com/pulumi/pulumi It would be good for us to help reduce this confusion
The get function is a static method of SshKey There is an actual GetSshKey class https://www.pulumi.com/docs/reference/pkg/digitalocean/getsshkey/
View count: 1