handsome-state-59775
05/10/2021, 8:17 PMStorageClassArgs
, but it errors out with:
File ".../venv/lib/python3.9/site-packages/pulumi_kubernetes/storage/v1/StorageClass.py", line 237, in __init__
__self__._internal_init(resource_name, *args, **kwargs)
TypeError: _internal_init() got an unexpected keyword argument 'args'
Call site looks something like this:
pulumi_kubernetes.storage.v1.StorageClass(
resource_name='string',
args=pulumi_kubernetes.storage.v1.StorageClassArgs(...),
opts=pulumi.ResourceOptions(),
)
Any insights please?curved-cartoon-90054
05/11/2021, 5:59 PMpulumi new -y
Please choose a template: aws-python A minimal AWS Python Pulumi program
Created project 'pulumi-bridge'
error: stack 'dev' already exists
magnificent-motherboard-76110
05/12/2021, 10:29 PMPulumi.env.yaml
I have declared:
config:
tools:data:
vpn:
vm:
name: servername
size: Standard_D4s_v2
registry:
config:
name: registryname
then from my ___main___.py
cfg = pulumi.Config().require_object('data')
vm = cfg.get('vpn').get('vm')
registry = cfg.get('registry').get('config')
later on when I use such var
vm = azure_native.compute.VirtualMachine(
"vpn-VirtualMachine",
hardware_profile=azure_native.compute.HardwareProfileArgs(
vm_size=config.vm.get('size'),
),
# ...
everything works, but when I use
registry = azure_native.containerregistry.Registry(
"container-Registry",
admin_user_enabled=True,
location=config.region,
registry_name=config.registry.get('name'),
even if it sees to be the same logic, I'm getting this error:
File "/<MY_PATH>/venv/lib/python3.8/site-packages/pulumi/runtime/stack.py", line 181, in massage
if not key.startswith("_"):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
error: an unhandled error occurred: Program exited with non-zero exit code: 1
any idea of what I'm doing wrong?clever-lawyer-94920
05/16/2021, 7:06 PMechoing-dawn-86996
05/19/2021, 1:25 PMgcp:project
that is configured in my stack. Is there a way to retrieve this?icy-policeman-83782
05/19/2021, 4:38 PMCFLAGS="-I /opt/homebrew/opt/openssl/include" LDFLAGS="-L /opt/homebrew/opt/openssl/lib" GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install -r requirements.txt
happy-ability-61825
05/20/2021, 10:36 AMMocks.call()
to mock the return value from a get request (in this case azure_native.network.get_subnet()
)
class MyMocks(pulumi.runtime.Mocks):
def call(self, args: pulumi.runtime.MockCallArgs):
return {}
What should I be returning from in this function to simulate the response from get_subnet()
?shy-author-33795
05/20/2021, 7:23 PM"""An AWS Python Pulumi program"""
from pulumi_aws import iam, s3
bucket = s3.Bucket(resource_name = 'elenas-cool-new-bucket'
and I'm getting a weird error:
Type Name Plan Info
pulumi:pulumi:Stack s3_buckets-dev 8 messages
└─ pulumi:providers:aws default_4_5_0 1 error
Diagnostics:
pulumi:pulumi:Stack (s3_buckets-dev):
panic: strconv.ParseUint: parsing "": invalid syntax
goroutine 1 [running]:
<http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.GetModuleMajorVersion(0x0|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.GetModuleMajorVersion(0x0>, 0x0, 0xc00153f5b0, 0x1)
/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.0.0/pkg/tfbridge/info.go:730 +0x1dc
<http://github.com/pulumi/pulumi-aws/provider/v4.Provider(0x0|github.com/pulumi/pulumi-aws/provider/v4.Provider(0x0>, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/runner/work/pulumi-aws/pulumi-aws/provider/resources.go:4173 +0x52e1b
main.main()
/home/runner/work/pulumi-aws/pulumi-aws/provider/cmd/pulumi-resource-aws/main.go:26 +0x37
pulumi:providers:aws (default_4_5_0):
error: could not read plugin [/Users/elena.washington/.pulumi/plugins/resource-aws-v4.5.0/pulumi-resource-aws] stdout: EOF
any idea how to fix this?thousands-art-55778
05/24/2021, 10:49 AMminiature-architect-54920
05/24/2021, 3:31 PMaws/instances/app1
aws/instances/app2
aws/instances/app3
sticky-bear-14421
05/25/2021, 11:45 AMcurrent_region = aws.get_region()
intermediate_provider = aws.Provider("IntermediateProvider", region=current_region.id,
assume_role={'role_arn': created_role.arn, 'session_name': 'abc'})
target_provider = aws.Provider("TargetProvider", region=current_region.id,
assume_role={'role_arn': external_role.arn, 'session_name': 'def'},
opts=ResourceOptions(provider=intermediate_provider))
some_ressource = aws.ec2...(opts=ResourceOptions(provider=target_provider))
This code fails with an ominous error message:
TypeError: Explicit providers may not be used with provider resources
hallowed-animal-47023
05/30/2021, 1:39 PMhallowed-animal-47023
05/30/2021, 1:40 PMtest (aws:ec2:Vpc)
+ aws:ec2/vpc:Vpc (create)
[urn=urn:pulumi:test::pulum::aws:ec2/vpc:Vpc::test]
__defaults : [
[0]: "assignGeneratedIpv6CidrBlock"
[1]: "instanceTenancy"
]
assignGeneratedIpv6CidrBlock: false
cidrBlock : "10.0.0.0/16"
enableDnsHostnames : true
enableDnsSupport : true
instanceTenancy : "default"
tags : {
Name : "test"
__defaults: []
}
NAT-Gateway-IP-0 (aws:ec2:Eip)
+ aws:ec2/eip:Eip (create)
[urn=urn:pulumi:test::pulum::aws:ec2/eip:Eip::NAT-Gateway-IP-0]
__defaults: []
tags : {
Name : "NAT-Gateway-IP-0"
__defaults: []
}
vpc : true
Diagnostics:
error: Duplicate resource URN 'urn:pulumi:test::pulum::aws:ec2/eip:Eip::NAT-Gateway-IP-0'; try giving it a unique name
NAT-Gateway-IP-1 (aws:ec2:Eip)
+ aws:ec2/eip:Eip (create)
[urn=urn:pulumi:test::pulum::aws:ec2/eip:Eip::NAT-Gateway-IP-1]
__defaults: []
tags : {
Name : "NAT-Gateway-IP-1"
__defaults: []
}
vpc : true
Stack Outputs:
vpc_id: Output<T>
hallowed-animal-47023
05/30/2021, 1:40 PMhallowed-animal-47023
05/30/2021, 1:45 PMhallowed-animal-47023
05/30/2021, 1:48 PMimport pulumi
from pulumi_aws import ec2, get_availability_zones
# Create AWS VPC with specified name, CIDR block, and enable DNS
class VPC(pulumi.ComponentResource):
"""
This creates a base VPC with subnets in every available availability zone
"""
def __init__(
self,
name,
opts=None
):
vpc = ec2.Vpc(name,
cidr_block="10.0.0.0/16",
enable_dns_support=True,
enable_dns_hostnames=True,
tags={
'Name': name
})
availability_zones = get_availability_zones(state="available")
public_subnets = []
private_subnets = []
for x in range(len(availability_zones.names)):
public_subnets.append(
ec2.Subnet(f"Prod-Public-{availability_zones.names[x]}",
availability_zone=availability_zones.names[x],
cidr_block=f"10.0.{x + 1}.0/24",
vpc_id=vpc.id,
tags={
'Name': f"Prod-Public-{availability_zones.names[x]}"
})
)
private_subnets.append(
ec2.Subnet(f"Prod-Private-{availability_zones.names[x]}",
availability_zone=availability_zones.names[x],
cidr_block=f"10.0.{x + len(availability_zones.names) + 1}.0/24",
vpc_id=vpc.id,
tags={
'Name': f"Prod-Private-{availability_zones.names[x]}"
})
)
nat_gateways = []
nat_eips = []
for x in range(2):
nat_eips.append(
ec2.Eip(
f"NAT-Gateway-IP-{x}",
vpc=True,
tags={
"Name": f"NAT-Gateway-IP-{x}"
}
)
)
# nat_gateways.append(
# ec2.NatGateway(
# f"{name}-NAT-Gateway",
# allocation_id=nat_eips[x],
# subnet_id=public_subnets[x].id,
# tags = {
# "Name": f"NAT-Gateway-{x}"
# })
# )
# Export VPC Id
pulumi.export('vpc_id', vpc.id)
url = vpc.id.apply(lambda vpc_id: "https//"+vpc_id)
hallowed-animal-47023
05/30/2021, 1:48 PMfew-pillow-1133
05/31/2021, 9:32 AMaws:elasticache:ReplicationGroup (mompltprdafelasticache-gitlab):
error: Preview failed: refreshing urn:pulumi:nonprod-plt-gitlab::elasticache::aws:elasticache/replicationGroup:ReplicationGroup::mompltprdafelasticache-gitlab: 1 error occurred:
* error listing tags for resource (arn:aws:elasticache:af-south-1::cluster:mompltprdafelasticache-gitlab-001): InvalidARN: account field cannot be empty.
status code: 400, request id: 2f3cce92-6d51-4006-8102-6fb635d11e0d
sticky-bear-14421
05/31/2021, 9:58 AMprivate_subnet_ids = aws.ec2.get_subnet_ids(
vpc_id=vpc.id, # created as the first resource in the stack
tags={"visibility": "private"} # filter by tags for the correct subnets
)
But, this consistently fails with the error message of:
Exception: invoke of aws:ec2/getSubnetIds:getSubnetIds failed: Missing required argument: The argument "vpc_id" is required, but no definition was found. ()
This worked before, while developing the code, as the VPC was created some days ago, but then we deleted the stack, and now everything should be created in a single run. I guess the call to aws.ec2.Vpc() hasn't returned yet with an vpc and its id when the call to get_subnet_ids() is being issued.sticky-bear-14421
06/04/2021, 1:50 PMredshift_cluster = aws.redshift.cluster(..)
pg_provider = postgresql.Provider('redshift_cluster',
database=redshift_cluster.database_name,
host=redshift_cluster.dns_name,
port=redshift_cluster.port,
username=redshift_cluster.master_username,
password=redshift_cluster.master_password)
my_user = postgresql.Role('my_user',
name="my_user",
password="123456",
login=True,
create_database=False,
create_role=False,
superuser=False,
opts=pulumi.ResourceOptions(provider=pg_provider)
But, when I try to apply this code it will fail with an SQL error:
error: error creating role my_user: pq: syntax error at or near "ROLE"
Any ideas what is wrong with my Role() definition?sparse-tomato-5980
06/08/2021, 8:51 PMpulumi.log.warn()
?gorgeous-minister-41131
06/11/2021, 10:36 PMd = self.create_deployment(
*args,
**kwargs,
extra_annotations={"<http://app.kubernetes.io/group|app.kubernetes.io/group>": "worker"},
extra_labels={"<http://app.kubernetes.io/group|app.kubernetes.io/group>": "worker"},
)
d.spec.replicas = 2
I find myself having to write custom classes that use Mixins to modify object properties before they’re passed to the constructor, to allow the object to be modified (just-before) it’s actually created…gorgeous-minister-41131
06/11/2021, 10:37 PMgorgeous-minister-41131
06/11/2021, 11:17 PMgorgeous-lifeguard-69736
06/18/2021, 11:34 AMgcp:serviceAccount:IAMMember (log-writer-iam):
error: 1 error occurred:
* Error applying IAM policy for service account 'projects/secret-stash-stadium/serviceAccounts/web-sa@secret-stash-stadium.iam.gserviceaccount.com': Error setting IAM policy for service account 'projects/secret-stash-stadium/serviceAccounts/web-sa@secret-stash-stadium.iam.gserviceaccount.com': googleapi: Error 400: Invalid service account (<pulumi.output.output object at 0x10c8f3310>)., badRequest
What am I doing wrong?
sa = serviceaccount.Account(
resource_name="sa",
account_id="web-sa",
)
log_writer_iam = serviceaccount.IAMMember(
resource_name="log-writer-iam",
member=f"serviceAccount:{sa.email}",
role="roles/logging.logWriter",
service_account_id=sa.name,
)
full-island-88669
06/18/2021, 2:37 PMCould not find a version that satisfies the requirement grpcio==1.38.0
More info: https://stackoverflow.com/questions/68036977/cannot-use-my-app-on-bitbucket-pipelines-could-not-find-a-version-that-satisfiegreat-sunset-355
06/19/2021, 8:37 AMpython __main__.py
I get an error Program run without the Pulumi engine available
.
I found this issue https://github.com/pulumi/pulumi/issues/1372#issuecomment-583086422
I tried what @white-balloon-205 suggested but I could not find the process.
Here is the code I tried from: https://www.pulumi.com/docs/intro/concepts/config/#structured-configuration
import pulumi
config = pulumi.Config()
data = config.require_object("data")
print("Active:", data.get("active"))
For some reason I do not even get the output of print
when I run pulumi up
Any clues?purple-appointment-84502
06/22/2021, 8:52 AMfrom ..common.commonComponentResource
And I'm getting relative import errors.
From my understanding, the work_dir
specified as part of the automation api, needs to be where the stack .yaml files are, and this is then used as the python working directory too.
Is there any way to have a different work directory to get around the relative import errors?
So the project structure I have is:
-- Common
---- CommonComponentResource.py
---- __init.py
-- Stack1
---- _main.py
---- yaml
-- Stack2
Thanks for your help!full-artist-27215
06/22/2021, 2:45 PMpulumi
CLI to interact with these projects and their stacks (e.g., if something goes wrong, I'd like to be easily do something like pulumi export
-> edit file -> pulumi import
, without having to also encode that via the Automation API). The best I've managed so far (though I'm still investigating) is to manipulate the sys.path
in my various __main__.py
in order to get the shared code importing correctly, but that seems like a hack I'd rather avoid.
Is there any guidance for how to structure things (with directory structures, configuration parameters, etc.) to be able to juggle multiple related Pulumi Python projects that share code? Thanks in advance.enough-leather-70274
06/22/2021, 11:18 PMwork_dir
param to be set to) a higher level directory than the project dir, e.g. a directory further up the hierarchy from the one containing the yaml and main.py files? That way common code can be shared between multiple pulumi projects as sibling or parent modules/ packages and imported in _main.py and python would resolve them (as they'd naturally be included in sys.path).
Or is there a different more obvious solution or workaround that I'm missing?