strong-helmet-83704
03/13/2023, 9:39 PMfierce-school-40904
03/15/2023, 11:36 AMopts=ResourceOptions(
parent=self,
aliases=[{'parent': pulumi.ROOT_STACK_RESOURCE}],
),
when moving a ressource from having no parent to having one. However this just seems to fail as aliases seems to require a 'name' parameter.
Am I understanding something wrong here?busy-lawyer-33856
03/16/2023, 2:29 PMgcp.monitoring.UptimeCheckConfig
class, when I'm a trying to pulumi up
the resource, I get the error:
creating UptimeCheckConfig: googleapi: Error 400: Name must begin with 'projects/{project_id}/groups/{group_id}', got: project/PROJECT_ID/groups/
but I don't understand what name there is referring to? There is no keyword argument call name and I don't see anything on this formed written in the examples on the document page.
Help will be appreciated!brave-motorcycle-67487
03/17/2023, 7:47 PMpulumi up
.
┌─[jamesph@Jamess-MBP] - [~/Documents/winfrastructure/aws] - [Fri Mar 17, 12:42]
└─[$]> venv/bin/pip freeze
Arpeggio==1.10.2
attrs==22.1.0
dill==0.3.5.1
grpcio==1.47.0
parver==0.3.1
protobuf==4.21.5
pulumi==3.39.3
pulumi-aws==5.17.0
pulumi-aws-native==0.29.0
PyYAML==6.0
semver==2.13.0
six==1.16.0
┌─[jamesph@Jamess-MBP] - [~/Documents/winfrastructure/aws] - [Fri Mar 17, 12:44]
└─[$]> cat requirements.txt
pulumi>=3.0.0,<4.0.0
pulumi-aws-native==0.52.0
pulumi-aws>=5.17.0,<6.0.0
pulumi-twingate>=0.0.43
┌─[jamesph@Jamess-MBP] - [~/Documents/winfrastructure/aws] - [Fri Mar 17, 12:44]
└─[$]> cat Pulumi.yaml
name: aws
description: AWS
runtime:
name: python
options:
virtualenv: venv
(Observe the much earlier version of pulumi-aws-native, and the missing pulumi-twingate.)
I could manually call pip install, but I'd like to know why this isn't workingpurple-electrician-80135
03/17/2023, 11:00 PMpurple-electrician-80135
03/17/2023, 11:01 PMprehistoric-tailor-40857
03/19/2023, 3:25 AMerror: failed to discover plugin requirements: creating virtual environment at /Users/workspace/venv: signal: killed
when doing pulumi up
, anybody ran into this before?prehistoric-tailor-40857
03/19/2023, 3:29 AMerror: failed to discover plugin requirements: calling "python -m pip list -v --format json": signal: killed
glamorous-fall-57889
03/21/2023, 7:58 AM"""An AWS Python Pulumi program"""
import iam
import pulumi
from pulumi import automation as auto
import pulumi_aws as aws
import sys
def pulumi_function():
main_vpc = aws.ec2.Vpc(resource_name="main-vpc", cidr_block="10.0.0.0/16")
subnet_ids = []
for index, zone in enumerate(aws.get_availability_zones().names):
vpc_subnet=aws.ec2.Subnet(f"subnet_{zone}",
vpc_id=main_vpc.id, cidr_block=f"10.0.{index}.0/24",
availability_zone=zone)
subnet_ids.append(vpc_subnet.id)
eks_cluster = aws.eks.Cluster('eks-cluster', role_arn=iam.eks_role.arn,tags={'Name': 'pulumi-eks-cluster','Owner': 'xxx' },
vpc_config=aws.eks.ClusterVpcConfigArgs(
# public_access_cidrs=['0.0.0.0/0'],
subnet_ids=subnet_ids
),
)
# pulumi.export('vpc_id', main_vpc.id)
destroy = False
args = sys.argv[1:]
if len(args) > 0:
if args[0] == "destroy":
destroy = True
project_name = "eks_project"
stack_name = "dev"
stack = auto.create_or_select_stack(stack_name=stack_name,
project_name=project_name,
program=pulumi_function)
print(f"Successfully initialized stack: {stack_name}")
if destroy:
print("destroying stack...")
stack.destroy(on_output=print)
print("stack destroy complete")
sys.exit()
stack.set_config("aws:region", auto.ConfigValue(value="eu-west-2"))
stack.up(on_output=print)
Error I get when I run (via python not the Pulumi CLI):
(venv) xxxx@xxxxs-MBP pulumi % python __main__.py
Successfully initialized stack: dev
Updating (dev):
+ pulumi:pulumi:Stack eks_project-dev creating (0s)
+ aws:ec2:Vpc main-vpc creating (0s)
+ pulumi:pulumi:Stack eks_project-dev creating (0s) error: python inline source runtime error: Task <Task pending name='Task-235' coro=<register_resource.<locals>.do_register() running at /Users/xxxx/projects/pulumi/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py:811> cb=[<TaskWakeupMethWrapper object at 0x1065e2e50>()]> got Future <Future pending> attached to a different loop
+ pulumi:pulumi:Stack eks_project-dev creating (0s) error: an unhandled error occurred: python inline source runtime error: Task <Task pending name='Task-235' coro=<register_resource.<locals>.do_register() running at /Users/xxxx/projects/pulumi/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py:811> cb=[<TaskWakeupMethWrapper object at 0x1065e2e50>()]> got Future <Future pending> attached to a different loop
@ updating....
+ aws:ec2:Vpc main-vpc created (1s)
@ updating.......
+ pulumi:pulumi:Stack eks_project-dev **creating failed (0.49s)** 2 errors
There is more stack trace / diagnostics hereenough-businessperson-85933
03/21/2023, 8:56 PMpulumi up
System:
• pulumi version
◦ v3.55.0
• kubectl version
◦ Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.6+k3s1", GitCommit:"9176e03c5788e467420376d10a1da2b6de6ff31f", GitTreeState:"clean", BuildDate:"2023-01-26T004747Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"}
◦ Kustomize Version: v4.5.7
◦ Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.3+k3s1", GitCommit:"f2585c1671b31b4b34bddbb3bf4e7d69662b0821", GitTreeState:"clean", BuildDate:"2022-10-25T195938Z", GoVersion:"go1.19.2", Compiler:"gc", Platform:"linux/amd64"}
• python version
◦ Python 3.11.2
• OS
◦ Ubuntu 20.04.5 LTS
Output:
>>> pulumi up
Previewing update (black_ant)
Type Name Plan Info
pulumi:pulumi:Stack blackant-pulumi-black_ant 3 messages
└─ pkg:index:App app
├─ pkg:index:frontend-deployment frontend
~ │ └─ kubernetes:apps/v1:Deployment blackant_frontendDeployment update [diff: ~spec]
+ └─ pkg:index:frontend-service frontend create
+ └─ kubernetes:core/v1:Service blackant_frontendService create
Diagnostics:
pulumi:pulumi:Stack (blackant-pulumi-black_ant):
Outputs:
+ frontend: "frontend"
Do you want to perform this update? yes
Updating (black_ant)
Type Name Status Info
pulumi:pulumi:Stack blackant-pulumi-black_ant **failed** 1 error
└─ pkg:index:App app
└─ pkg:index:frontend-deployment frontend
~ └─ kubernetes:apps/v1:Deployment blackant_frontendDeployment **updating failed** [diff: ~spec]; 1 error
Diagnostics:
kubernetes:apps/v1:Deployment (blackant_frontendDeployment):
error: update of resource blackant-components/frontend failed because the Kubernetes API server reported that it failed to fully initialize or become live: deployments.apps "frontend" not found
pulumi:pulumi:Stack (blackant-pulumi-black_ant):
error: update failed
Outputs:
+ frontend: "frontend"
Resources:
5 unchanged
Duration: 7s
app.py
import os
import pulumi
from pulumi import ResourceOptions
from modules.app.deployment.frontend_deployment import Frontend
from modules.app.service.frontend_service import FrontendService
class App(pulumi.ComponentResource):
def __init__(self, name, opts=None):
super().__init__('pkg:index:App', name, None, opts)
frontend = Frontend(
replica_count=3,
version="latest", # prod_version,
canary=False,
opts=ResourceOptions(parent=self)
)
frontend_service = FrontendService(
opts=ResourceOptions(
parent=self,
depends_on=[frontend]
)
)
frontend_deployment.py
import pulumi
from pulumi import Config, ResourceOptions
from pulumi_kubernetes.apps.v1 import Deployment, DeploymentSpecArgs
from pulumi_kubernetes.core.v1 import PodTemplateSpecArgs, PodSpecArgs, ContainerArgs, EnvVarArgs, ContainerPortArgs, \
Service, ServiceSpecArgs, ServicePortArgs, LocalObjectReferenceArgs
from pulumi_kubernetes.meta.v1 import ObjectMetaArgs, LabelSelectorArgs
from modules.app.deployment.blackant_deployment import BlackantDeployment
class Frontend(BlackantDeployment):
def __init__(self, replica_count, version, canary, opts=None):
super().__init__("frontend", version, replica_count, canary, None, opts)
cfg = Config()
blackant_frontend_deployment = Deployment(
"blackant_frontendDeployment",
api_version="apps/v1",
kind="Deployment",
metadata=ObjectMetaArgs(
name=self._fullname,
labels={
"app": "blackant",
"tier": "frontend",
},
namespace="blackant-components",
),
spec=DeploymentSpecArgs(
replicas=replica_count,
selector=LabelSelectorArgs(
match_labels={
"tier": "frontend",
},
),
template=PodTemplateSpecArgs(
metadata=ObjectMetaArgs(
labels={
"tier": "frontend",
},
),
spec=PodSpecArgs(
image_pull_secrets=[LocalObjectReferenceArgs(name="blackant-image-pull-secret")],
containers=[
ContainerArgs(
name="blackant-frontend",
image=f"{cfg.require('docker_registry')}/system/frontend:{version}",
env=[
EnvVarArgs(
name="CANARY",
value=canary.__str__()
),
]
)
],
),
),
),
opts=ResourceOptions(parent=self)
)
print("REALLY AFTERRR")
blackant_deployment.py
from typing import Mapping, Awaitable
import pulumi
from pulumi import Config, Output, ResourceOptions
from modules.util.configuration_resolver import ConfigurationResolver
class BlackantDeployment(pulumi.ComponentResource):
def __init__(
self,
name: str,
version: str,
replica_count: int,
canary: bool,
props: Mapping[str, Awaitable | Output] | None = None,
opts: ResourceOptions | None = None
):
super().__init__(f'pkg:index:{name}-deployment{"" if not canary else "-canary"}', name, props, opts)
self._fullname = f'{name}{"" if not canary else "-canary"}'
Thanks in advance,
Milanbusy-lawyer-33856
03/22/2023, 7:12 AMpulumi_gcp.sql
.
I have found the library pulumi_postgresql
, but I find it hard to get it to work from the documentation.
I have made tried making the resource pulumi_postgresql.Grant
:
grants_to_user = postgresql.Grant("user-GRANTS",
database=database.name,
object_type="database",
privileges=["SELECT"],
role=db_role.name,
)
where db_role.name
is made with pulumi_postgresql.Role
:
db_role= postgresql.Role('DB-ROLE',
login=True,
roles=["SELECT"],
password = 'PASSWORD'
)
They both grant the same error:
error: 1 error occurred:
* error detecting capabilities: error PostgreSQL version: dial tcp [::1]:5432: connect: connection refused
I find it hard to debug this error, so I was wondering if anyone have a solution for the problem?
Any help is greatly appreciated!
Best Regards
Eliasgorgeous-minister-41131
03/23/2023, 4:56 PMpulumi plugin install
when installing Pip/python pulumi libraries out of band? (e.g. we're using Pipfile). For context here, in this instance, pulumi is being managed via the asdf tool, but the global version is not set (on purpose) so we can rely on the .tool-versions
file. This means when pulumi is invoked from the cwd of the project's original Pulumi.yaml
file this is not a problem, but when pipenv goes to install it uses a tmp directory which does not contain the .tool-versions
file.
I'd rather install these plugins via pulumi plugin install
instead, if possible.
[pipenv.exceptions.InstallError]: File "/tmp/pip-install-qcukotzg/pulumi-aws_d0831f623f8341148f9146396ab524dc/setup.py", line 18, in run
[pipenv.exceptions.InstallError]: check_call(['pulumi', 'plugin', 'install', 'resource', 'aws', PLUGIN_VERSION])
[pipenv.exceptions.InstallError]: File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
[pipenv.exceptions.InstallError]: raise CalledProcessError(retcode, cmd)
[pipenv.exceptions.InstallError]: subprocess.CalledProcessError: Command '['pulumi', 'plugin', 'install', 'resource', 'aws', '5.32.0']' returned non-zero exit status 126.
[pipenv.exceptions.InstallError]: [end of output]
[pipenv.exceptions.InstallError]:
hundreds-lunch-5706
03/23/2023, 10:07 PMgorgeous-minister-41131
03/23/2023, 10:10 PMargs=
keyword and pass in an instantiated WhateverArgs class or use each arg from that class in the constructor of the resource? I notice a lot of TypeScript examples have the second parameter be the entire object of args (class), but a lot of python examples use the named keyword arguments of args as part of the resources' constructor arguments...magnificent-account-30070
03/24/2023, 8:33 AMmysterious-area-77666
03/24/2023, 1:00 PMpassword_policy
key https://www.pulumi.com/registry/packages/keycloak/api-docs/realm/#password_policy_python and its allowed/accepted values. For example, the keycloak server has an password policy in the UI Not Recently Used
. If I want to use that value in password_policy, should it be notRecentlyUsed(3)
? I looked through the keycloak docs search for anything under PasswordPolicy
but didn’t come across that value https://www.keycloak.org/docs-api/21.0.1/javadocs/index-all.html
Would greatly appreciate it if someone has any functional examples around that bit.miniature-gigabyte-99238
03/28/2023, 8:17 AM<https://pastebin.com/MFzmv47L>
Now it complains about multiple parts. So for example the os_profile part should be
os_profile=azure_native.compute.OSProfileArgs(
admin_password="{your-password}",
admin_username="{your-username}",
computer_name="myVM",
),
so I should use the xyzArgs function. I can do that but why are so many examples not using the Args but the way I use it in the pastebin? Is there two ways of doing it? One prefered about the other? Or is the non Args way for for the old Azure Provider and Args for the azure native one?
Just trying to understand why.bulky-oil-16941
03/29/2023, 10:44 AMprimary = gcp.clouddeploy.Target("primary",
location="us-west1",
annotations={
"my_first_annotation": "example-annotation-1",
"my_second_annotation": "example-annotation-2",
},
description="basic description",
execution_configs=[gcp.clouddeploy.TargetExecutionConfigArgs(
usages=[
"RENDER",
"DEPLOY",
],
execution_timeout="3600s",
)],
labels={
"my_first_label": "example-label-1",
"my_second_label": "example-label-2",
},
project="my-project-name",
require_approval=False,
run=gcp.clouddeploy.TargetRunArgs(
location="projects/my-project-name/locations/us-west1",
),
opts=pulumi.ResourceOptions(provider=google_beta))
numerous-alarm-76016
03/31/2023, 11:59 AMmillions-pharmacist-626
04/05/2023, 5:08 PMget_<some-resource>_output()
(for example s3.get_bucket_output()
).
The first screenshot is what autosuggestion shows using Python. The second one is using TypeScript instead.
Is there any way to fix this ?calm-doctor-76791
04/05/2023, 8:02 PMstack = pulumi.StackReference(aca_stack_ref)
default_domain = stack.get_output("default_domain").apply(lambda x: x)
default_domain_arr = default_domain.split(".")
....
Which returns the following when ran;
default_domain_arr = default_domain.split(".")
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'Output' object is not callablebig-greece-60903
04/11/2023, 8:05 PMpulumi.Output.all(bucket.id).apply(lambda y: f"{y}")
- also tried:
import json
import pulumi
import pulumi_aws as aws
# Create an AWS resource (S3 Bucket)
bucket = aws.s3.Bucket('kollective-data')
# Export the name of the bucket
pulumi.export('bucket_name', bucket.id)
# Create an event rule to watch for events.
s3_rule = aws.cloudwatch.EventRule("rule",
event_pattern=json.dumps({"source": ["aws.s3"],
"detail-type": ["Object Created"],
"bucket": [pulumi.Output.all(bucket.id).apply(lambda y: f"{y}")],
"object": {
"key": [{
"prefix": "user-data/roger/"
}
]
}
})
)
wide-apple-61576
04/12/2023, 7:19 AMorange-airport-64592
04/13/2023, 8:58 AMpulumi_aws_apigateway
and pulumi_aws.apigateway
?wide-apple-61576
04/14/2023, 6:11 AMquaint-match-50796
04/15/2023, 10:45 PMastonishing-branch-30086
04/20/2023, 10:31 AMpulumi preview --diff
I would like to see the specific lines in the file that have changed.plain-train-21612
04/20/2023, 7:39 PMorange-airport-64592
04/21/2023, 3:10 AMaws.apigateway.get_resource
, I want to know how to wait for a resource to be created before obtaining its attribute using Pulumi. Here is my code.
rest_api = aws.apigateway.RestApi(
resource_name="login",
name="login",
body=ApiFile("login.yaml").body,
)
# This may be failed , I think is caused by the resource had not been created
resource = aws.apigateway.get_resource(
rest_api_id=rest_api.id,
path="/login",
)
kind-jelly-61624
04/24/2023, 4:40 PM"aws:iam/getPolicyDocumentStatementCondition:getPolicyDocumentStatementCondition": {
"properties": {
"test": {
"type": "string",
"language": {
"python": {
"mapCase": false
}
}
},