• h

    hallowed-animal-47023

    3 weeks ago
    Is there any cleaner documentation for the Python SDK? I'm hoping I'm missing something - https://www.pulumi.com/docs/reference/pkg/python/pulumi/
    h
    1 replies
    Copy to Clipboard
  • l

    limited-continent-1382

    1 week ago
    Hello there, We know we can export values programmatically by using
    pulumi.export("ip", "0.0.0.0")
    , but is there a way to get that exported value from that key using Python?
    l
    m
    +1
    31 replies
    Copy to Clipboard
  • b

    bland-thailand-60821

    1 week ago
    import pulumi
    import pulumi_equinix_metal as equinix_metal
    
    test = equinix_metal.Connection("test",
        organization_id=local["my_organization_id"],
        project_id=local["my_project_id"],
        metro="sv",
        redundancy="redundant",
        type="shared")
    __ERROR-----------------------
    Diagnostics:
      pulumi:pulumi:Stack (mosk-auto-test):
        error: Program failed with an unhandled exception:
        Traceback (most recent call last):
          File "./__main__.py", line 4, in <module>
            test = equinix_metal.Connection("test",
        AttributeError: module 'pulumi_equinix_metal' has no attribute 'Connection'
    b
    s
    13 replies
    Copy to Clipboard
  • l

    limited-continent-1382

    6 days ago
    Hi guys, I am going to use dynamic data masking feature in bigquery. In order to use dynamic masking feature we need to follow bellow steps. 1. Create a taxonomy of policy tags using data catalog - ( was able to automate using gcp pulumi provider) https://www.pulumi.com/registry/packages/gcp/api-docs/datacatalog/policytag/ 2. Attach data policies for created policy tags in above step - ( couldn't find a support functionality from pulumi) here I want to configure masking rules and principals. Is it possible to automate this as well using pulumi?
    l
    s
    9 replies
    Copy to Clipboard
  • f

    future-france-34957

    6 days ago
    Hey all Have a Pulumi Output array of objects (route53 hosted_zones) that looks like this:
    ~ hosted_zones: [
          ~ [0]: {
                    arn              : "arn:aws:route53:::hostedzone/Z06813069DDF4BVP5B49"
                    comment          : "Hosted Zone for <http://env.example.com|env.example.com>"
                    force_destroy    : false
                    id               : "Z06813069DDF4BVP5B49"
                    name             : "<http://env.example.com|env.example.com>"
                    name_servers     : [
                        [0]: "<http://ns-1074.awsdns-09.org|ns-1074.awsdns-09.org>"
                        [1]: "<http://ns-1944.awsdns-52.co.uk|ns-1944.awsdns-52.co.uk>"
                        [2]: "<http://ns-475.awsdns-53.com|ns-475.awsdns-53.com>"
                        [3]: "<http://ns-948.awsdns-52.net|ns-948.awsdns-52.net>"
                    ]
                    tags_all         : {
                        provisioner: "pulumi"
                    }
                    urn              : "urn:pulumi:all::shared::aws:route53/zone:Zone::<http://env.example.com|env.example.com>"
                    zone_id          : "Z06813069DDF4BVP5B49"
                }
          ~ [1]: {
                    arn              : "arn:aws:route53:::hostedzone/Z05663573HLFBZ66YBFM2"
                    comment          : "Hosted Zone for env.example.link"
                    force_destroy    : false
                    id               : "Z05663573HLFBZ66YBFM2"
                    name             : "env.example.link"
                    name_servers     : [
                        [0]: "<http://ns-1311.awsdns-33.org|ns-1311.awsdns-33.org>"
                        [1]: "<http://ns-1733.awsdns-22.co.uk|ns-1733.awsdns-22.co.uk>"
                        [2]: "<http://ns-191.awsdns-21.com|ns-191.awsdns-21.com>"
                        [3]: "<http://ns-786.awsdns-36.net|ns-786.awsdns-36.net>"
                    ]
                    tags_all         : {
                        provisioner: "pulumi"
                    }
                    urn              : "urn:pulumi:all::shared::aws:route53/zone:Zone::env.example.link"
                    zone_id          : "Z05663573HLFBZ66YBFM2"
                }
        ]
    I want to get, for example, the
    zone_id
    where
    name
    =
    <http://env.example.com|env.example.com>
    My thought was to search the array for the index, for example, where
    name
    =
    <http://env.example.com|env.example.com>
    , in this case
    [0]
    and then get the the value of
    zone_id
    at that index (similar to this https://stackoverflow.com/a/19868472) However, since this is a Pulumi Output object, I can’t iterate it like that:
    TypeError: 'Output' object is not iterable, consider iterating the underlying value inside an 'apply'
    So I attempted to first convert the object to json, using a render function (which has worked for me when needing a Pulumi Output object as a string, like this https://stackoverflow.com/a/73558276/18101704) but that doesn’t work either:
    def get_shared_hosted_zones_to_string(shared_hosted_zones):
                return json.dumps(shared_hosted_zones)
    
            def get_zone_index(shared_hosted_zones_string, name):
                return next(index for index, element in enumerate(shared_hosted_zones_string)
                            if element["name"] == name)
    
            # For each domain, create Hosted Zone
            # i.e. (<http://uat.env.example.com|uat.env.example.com>, uat.env.example.link)
            for domain, name in domains.items():
                hosted_zone = route53.Zone(
                    resource_name=f"{env_stack}.{domain_prefix}.{name}",
                    name=f"{env_stack}.{domain_prefix}.{name}",
                    comment=f"Hosted Zone for {env_stack}.{domain_prefix}.{name}",
                    tags=TAGS,
                    opts=ResourceOptions(protect=True)
                )
    
                shared_hosted_zones_string = Output.all(shared_hosted_zones).apply(
                    lambda shared_hosted_zones: get_shared_hosted_zones_to_string(shared_hosted_zones))
    
                # select the hosted zone id where shared_hosted_zones.[].name == domain name
                # i.e. which object in the hosted_zones array has name : "<http://env.example.com|env.example.com>",
                #      because need to get that zone_id
                shared_hosted_zone = shared_hosted_zones_string[get_zone_index(
                    shared_hosted_zones_string, domain_prefix + name)]
    shared_hosted_zones_string
    is of type Output though. I don’t fully understand how this works here, but not in this case? Any ideas?
    f
    b
    5 replies
    Copy to Clipboard
  • s

    steep-lamp-20408

    5 days ago
    Hi all, I have a Pulumi script
    __main__.py
    working fine, executed with
    pulumi up
    CLI command. In that script I need to use the Python
    toml
    module, so I installed it the project dependencies and venv. Now, when I do
    pulumi up
    , I get the error:
    import toml
    ModuleNotFoundError: No module named 'toml'
    (needless to say everything is done in a venv where I double checked that
    toml
    was actually installed, with
    pip list
    ). It would seem that it’s not supported by Pulumi to use third-party Python modules in a Pulumi script? Or did I miss something?
    s
    b
    10 replies
    Copy to Clipboard
  • a

    alert-monitor-28534

    5 days ago
    Hi, I'm trying to create RKE cluster to instances in Oracle Cloud, but because the RKE provider is too old it doesn't work for ARM cluster I have. I'm trying to run RKE CLI manually, using Jinja2 templating to create the cluster configuration YAML - the problem is that I just cannot get the IP addresses of the instances to the YAML as I get this when trying to render the template:
    - address: Calling __str__ on an Output[T] is not supported.
        To get the value of an Output[T] as an Output[str] consider:
        1. o.apply(lambda v: f"prefix{v}suffix")
        See <https://pulumi.io/help/outputs> for more details.
        This function may throw in a future version of Pulumi.
    This is what I've tried to do:
    vm1_public_ip_str = vm1.public_ip.apply(lambda public_ip: f"{public_ip}")
    And this is how the cluster YAML should be generated:
    output = cluster_template.render(
        user="ubuntu",
        master_public_ip=vm1_public_ip_str,
        master_int_ip=vm1_private_ip_str,
        worker_public_ip=vm2_public_ip_str,
        worker_int_ip=vm2_private_ip_str,
        ssh_key_path=ssh_key_path,
    )
    What to try next? Thanks in advance for the help!
    a
    s
    3 replies
    Copy to Clipboard
  • b

    breezy-knife-24305

    1 week ago
    I'm trying to perform introspection of the AWS resources (
    pulumi_aws
    ) so that we can dynamically define configuration templates. I'm running into the following issue:
    Traceback (most recent call last):
      File "~/Documents/workspace/ops/pulumi/pulumi-config.py", line 17, in <module>
        import pulumi_aws as aws
      File "~/.virtualenvs/pulumi/lib/python3.9/site-packages/pulumi_aws/__init__.py", line 5, in <module>
        from . import _utilities
      File "~/.virtualenvs/pulumi/lib/python3.9/site-packages/pulumi_aws/_utilities.py", line 15, in <module>
        import pulumi.runtime
    ModuleNotFoundError: No module named 'pulumi.runtime'; 'pulumi' is not a package
    Any ideas on how I can get
    pulumi.runtime
    recognized?
    b
    s
    6 replies
    Copy to Clipboard
  • s

    stocky-father-68249

    3 days ago
    Hey guys. Is there a way how I can turn on canary deployments in ecs using pulumi python?