sparse-state-34229
06/11/2020, 8:42 PMincalculable-dream-27508
06/12/2020, 11:46 AMincalculable-dream-27508
06/12/2020, 11:52 AMincalculable-dream-27508
06/12/2020, 11:55 AMlittle-garage-43399
06/14/2020, 10:05 AMfrom pxglb import *
pxglb is a file with classes I have built. This import is worked fine, until I have added to pxflb file a new class, a "ResourceProvider" classlittle-garage-43399
06/14/2020, 10:05 AMclass PXNS1RecordProvider(ResourceProvider):
In this case I get the following error:
error: Exception calling application: No module named 'pxglb'
If I copy paste the classes code into the "main" file (instead of the import), it works fine.
Pulumi version: 2.4.0
Python version: 3.7.7sparse-state-34229
06/14/2020, 8:06 PMfast-whale-9064
06/15/2020, 5:46 PMastonishing-quill-88807
06/16/2020, 3:37 PMipaddress.IPv6Network
call which is throwing errors about the type being invalid. I've tried using the .apply
approach which doesn't seem to be working since the return value of an apply is still an Output object. How do I just access the underlying string to create the network object?astonishing-quill-88807
06/16/2020, 3:37 PMv6net = IPv6Network(olvpc.ipv6_cidr_block.apply(lambda cidr: f'{cidr}'))
where olvpc
is the return value of a call to pulumi_aws.ec2.Vpc
astonishing-quill-88807
06/16/2020, 4:56 PMget_vpc
that doesn't match an existing resource, it throws an exception which still causes execution to fail even if I catch it. What's the option for handling that situation?powerful-pharmacist-31524
06/18/2020, 1:02 PMmock_image = docker.Image('mock-server-image',
build=docker.DockerBuild(context='../',
dockerfile=f'../Dockerfile'),
image_name=f'{repo.repository_url}',
registry=registry)
But as soon as I add an environment variable …
mock_image = docker.Image('mock-server-image',
build=docker.DockerBuild(context='../',
dockerfile=f'../Dockerfile',
env={'MOCK_PORT': '80'}),
image_name=f'{repo.repository_url}',
registry=registry)
I get an error: FileNotFoundError: [Errno 2] No such file or directory: 'docker': 'docker'
chilly-hairdresser-56259
06/18/2020, 3:40 PMquit()
would work, but that caused all my resources to be destroyed. Luckily that is a sandbox environment for testing before it gets released to any account which has running resources. I see pulumi has pulumi.Error()
but havent found the docs for it yet.stocky-lion-56153
06/19/2020, 11:00 AMerror: "/github/workspace/venv" doesn't appear to be a virtual environment
. Can anyone here tell me how to activate my venv in the uses:
block please? Thanks!stocky-lion-56153
06/19/2020, 11:01 AMname: Pulumi
on:
push:
branches:
- master
jobs:
up:
name: Update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: <docker://pulumi/actions>
with:
args: up --yes
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_CI: up
stocky-lion-56153
06/19/2020, 11:02 AMastonishing-quill-88807
06/19/2020, 3:19 PMregister_outputs
function in a component, does anyone have a detailed example of passing specific outputs? Most of the Python examples in the Pulumi examples repo call it with an empty dict literal. Will that actually set any outputs to be registered? From the docs it seems that I should be doing something like https://github.com/mitodl/ol-infrastructure/blob/rds_component/src/ol_infrastructure/components/aws/olvpc.py#L202-L207astonishing-quill-88807
06/19/2020, 3:20 PMworried-plastic-45846
06/23/2020, 3:39 PMpulumi up
runs?flat-australia-79845
06/24/2020, 7:44 AMgcp.config.region
to have a value during testing. Any idea?damp-elephant-82829
06/28/2020, 1:33 PMmelodic-alarm-79754
06/28/2020, 9:15 PMquick-cricket-80200
06/28/2020, 9:38 PMquiet-painter-30539
06/30/2020, 9:21 AMearly-window-97394
07/02/2020, 7:05 AMsteep-alligator-79173
07/02/2020, 8:10 AMGet instance stack config
config_instance = pulumi.Config("instance")
config_instance = pulumi.Config("instance")
When I try to run tests I get:
ERROR: test_core_stack (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_core_stack
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 436, in _find_test_path
module = self._get_module_from_name(name)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "/Users/pawelmadon/git/a4b/poc/qx-pulumi/core-stack/test_core_stack.py", line 13, in <module>
import core_stack
File "/Users/pawelmadon/git/a4b/poc/qx-pulumi/core-stack/core_stack.py", line 54, in <module>
instance_type=config_instance.require('bastion_size'),
File "/Users/pawelmadon/git/a4b/poc/qx-pulumi/core-stack/venv/lib/python3.7/site-packages/pulumi/config.py", line 214, in require
raise ConfigMissingError(self.full_key(key))
pulumi.config.ConfigMissingError: Missing required configuration variable 'instance:bastion_size'
please set a value using the command `pulumi config set instance:bastion_size <value>`
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
(venv)
How I can import configuration to tests ?stocky-lion-56153
07/02/2020, 10:19 AMpulumi stack select --create <stack name>
steep-alligator-79173
07/02/2020, 8:23 PM# Get az's for region
azs = aws.get_availability_zones(state="available")
Now when I try to run test :
File "/Users/unittests/infra.py", line 79, in <module>
for num, az in enumerate(azs.zone_ids):
TypeError: 'NoneType' object is not iterable
in Pulumi documentation i found:
call(token: string, args: any, provider?: undefined | string): Record<string, any>
call mocks provider-implemented function calls (e.g. aws.get_availability_zones).
But I have no idea how I can mock this call. For any code snippet I would be gratefulrhythmic-napkin-82334
07/04/2020, 6:16 PMflat-australia-79845
07/06/2020, 1:39 PM__pycache__
folders from the artifacts that I push to the cloud. Today I made this work in Pulumi with:
from fnmatch import fnmatch
from typing import Dict, Iterable, Union
from pathlib import Path
from pulumi.asset import Asset, Archive, AssetArchive, FileArchive, FileAsset
def filter_file_archive(
path: str, archive: FileArchive, exclude_patterns: Iterable[str] = None
) -> Dict[str, FileAsset]:
if not exclude_patterns:
exclude_patterns = []
file_iterator = Path(archive.path).rglob('*')
asset_root = Path(path)
assets = {
str(asset_root / file.relative_to(archive.path)): FileAsset(str(file))
for file in file_iterator if not any({fnmatch(file, pattern) for pattern in exclude_patterns})
}
return assets
class CodeAsset(AssetArchive):
def __init__(self, assets: Dict[str, Union[Asset, Archive]], exclude_patterns: Iterable[str] = None):
assets = self._filter_assets(assets, exclude_patterns)
super().__init__(assets=assets)
def _filter_assets(
self, assets: Dict[str, Union[Asset, Archive]], exclude_patterns: Iterable[str] = None
) -> Dict[str, Union[Asset, Archive]]:
filtered_assets: Dict[str, Union[Asset, Archive]] = {}
for path, asset in assets.items():
if isinstance(asset, FileArchive):
filtered_assets.update(filter_file_archive(path, asset, exclude_patterns))
else:
filtered_assets[path] = asset
return filtered_assets
then I use it this way:
archive = gcp.storage.BucketObject(
f'{function_name}-cloudfunction.zip',
bucket=bucket.name,
source=CodeAsset({
'.': pulumi.asset.FileArchive(str(source_folder / 'pairbot')),
'lib': pulumi.asset.FileArchive(str(source_folder / 'lib')),
}, exclude_patterns={'**/__pycache__*', '**/tests*'}),
)