colossal-room-15708
09/08/2019, 6:28 AMlocal-exec
equivalent?millions-farmer-54084
09/08/2019, 8:57 PMmolecule
for Ansible? Or do we use the golang
tool as described in https://www.pulumi.com/blog/testing-your-infrastructure-as-code-with-pulumi/ ?white-jewelry-95626
09/09/2019, 3:38 PMwhite-jewelry-95626
09/09/2019, 3:39 PMwhite-jewelry-95626
09/09/2019, 3:40 PMnumerous-easter-93888
09/09/2019, 7:22 PMinfra = pulumi.StackReference("my/project/stack")
public_subnet_ids = pulumi_aws.Provider("aws", {'public_subnet_ids': infra.get_output('Public Subnet IDs'))
private_subnet_ids = 'pulumi_aws.Provider("aws", {'web_subnet_ids': infra.get_output('Web Private Subnet IDs')
vpc_id = pulumi_aws.Provider("aws", {'vpc_id': infra.get_output('vpc_id')})
colossal-barista-38672
09/10/2019, 8:06 PMfast-hamburger-46413
09/15/2019, 2:22 AMpulumi up -c var1=val1,var2=val2
) and / or configuration files (pulumi up --config-file
) in the python code?fast-hamburger-46413
09/15/2019, 2:25 AMconfig-file.txt
):
var1=val1
var2=val2
...
Or itβs exact the same as .tfvars
file?gray-nest-70702
09/16/2019, 3:36 PMTypeError: unsupported operand type(s) for +: 'dict_values' and 'list'
. https://github.com/pulumi/pulumi/issues/3235better-actor-92669
09/17/2019, 9:36 AMgcp-python
. For instance, I want to store my buckets definitions in a separate directory or in python terms, simply in a separate python package, instances in another one, vpn and network definition in yet another one, and so on. With the directory structure below, I managed to import packages' code into pulumi's __main__.py
and make it work. Nevertheless, I don't like that I have to do import statements import pulumi
from pulumi_gcp import storage
both in a package module and in __main__.py
itself. I know that am probably doing this wrong, so my question is:
What is the best practice to separate pulumi resources as python packages?
I would really appreciate some examples of how some of you do that.
tree structure:
(pulumi_venv) some_user@MAC-C02YG37SJGH some-pulumi (master) $ tree
.
βββ Pulumi.dev.yaml
βββ Pulumi.yaml
βββ __main__.py
βββ __pycache__
β βββ __main__.cpython-37.pyc
βββ buckets
β βββ __init.py__
β βββ __pycache__
β β βββ bucket_func.cpython-37.pyc
β β βββ bucket_plain.cpython-37.pyc
β βββ bucket_func.py
β βββ bucket_plain.py
βββ requirements.txt
3 directories, 10 files
buckets/bucket_func.py which has a bucket creation within a function:
import pulumi
from pulumi_gcp import storage
def create_bucket5():
# Create a GCP resource (Storage Bucket)
bucket = storage.Bucket('pulumi-test-bucket-5', name="pulumi-test-bucket-5")
# Export the DNS name of the bucket
pulumi.export('bucket_name', bucket.url)
buckets/bucket_plain.py which is a plain code file not wrapped into a function or something:
import pulumi
from pulumi_gcp import storage
# Create a GCP resource (Storage Bucket)
bucket = storage.Bucket('pulumi-test-bucket-5', name="pulumi-test-bucket-5")
# Export the DNS name of the bucket
pulumi.export('bucket_name', bucket.url)
and the main.py for the buckets/bucket_func
import pulumi
from pulumi_gcp import storage
-->>import buckets.bucket_func
# State bucket
# Create a GCP resource (Storage Bucket)
bucket1 = storage.Bucket('pulumi-test-bucket-2')
# Export the DNS name of the bucket
pulumi.export('bucket_name', bucket1.url)
-->>buckets.bucket_func.create_bucket5()
and also the main.py for the second case buckets/bucket_plain:
import pulumi
from pulumi_gcp import storage
-->>import buckets.bucket_plain
# State bucket
# Create a GCP resource (Storage Bucket)
bucket1 = storage.Bucket('pulumi-test-bucket-2')
# Export the DNS name of the bucket
pulumi.export('bucket_name', bucket1.url)
In both cases it works and creates a pulumi-test-bucket-5
bucket. Please note the pulumi-test-bucket-2
in __main__.py
is just a state bucket for pulumi.
(pulumi_venv) some_user@MAC-C02YG37SJGH some-pulumi (master) $ pulumi up
Enter your passphrase to unlock config/secrets
(set PULUMI_CONFIG_PASSPHRASE to remember):
Previewing update (dev):
Type Name Plan
pulumi:pulumi:Stack lodgify-pulumi-dev
+ ββ gcp:storage:Bucket pulumi-test-bucket-5 create
Resources:
+ 1 to create
2 unchanged
Do you want to perform this update?
yes
> no
details
boundless-room-36997
09/17/2019, 1:51 PMstocky-spoon-28903
09/17/2019, 2:07 PMstocky-spoon-28903
09/17/2019, 2:07 PMalert-monitor-28534
09/18/2019, 5:20 AMkubectl
works:alert-monitor-28534
09/18/2019, 2:33 PMsparse-cpu-53654
09/18/2019, 4:42 PMpulumi-kubernetes
recently (e.g. with pip)? it's failing for me during setup.py in multiple environmentsquick-australia-29016
09/19/2019, 4:30 AMfast-hamburger-46413
09/24/2019, 7:49 AMfast-hamburger-46413
09/24/2019, 7:50 AMfast-hamburger-46413
09/24/2019, 7:53 AMfreezing-artist-51725
09/26/2019, 12:57 AMwhite-jewelry-95626
09/27/2019, 9:41 AMalert-monitor-28534
10/02/2019, 6:49 AMtransformations
with Helm charts? I'd like to change ingress values of Jenkins chart and I've mostly found examples with JS etc. which I really don't understand.clean-engineer-75963
10/04/2019, 4:47 PMbase64.b64encode
and it's not working since it's a pulumi.Output
and not a bytes-like object.clean-engineer-75963
10/04/2019, 5:08 PMpulumi_random
provider to generate a password, then store it in a Kubernetes secret with pulumi_kubernetes
. The code looks like this:
python
password = pulumi_random.RandomPassword(password_name, length=32)
secret = corev1.Secret(
password_name,
data={"pw": password.result.apply(lambda result: base64.b64encode(result.encode("utf-8")))},
)
clean-engineer-75963
10/04/2019, 5:44 PMclean-engineer-75963
10/04/2019, 9:45 PMclean-engineer-75963
10/04/2019, 11:18 PMpulumi up
.white-jewelry-95626
10/07/2019, 1:59 PMwhite-jewelry-95626
10/07/2019, 1:59 PM