fancy-eve-82724
11/05/2021, 7:11 PMfancy-eve-82724
11/09/2021, 1:18 PMalternatives
but I may prefer to leave that be, and just use python 3.8 with Pulumi. There's the directive in Pulumi.yaml to specify the virtualenv directory, but is there are directive for specifying which interpreter to use?
2 runtime:
3 name: python
4 options:
5 virtualenv: venv
fancy-eve-82724
11/09/2021, 1:29 PMPULUMI_PYTHON_CMD
environment variable will docold-minister-39214
11/09/2021, 8:38 PMconfig.require_secret
on a structured object? i.e. if I use pulumi config set --secret --path things.thing1.token secret_value
is there a way to do config.require_secret('things.thing1.token')
? When I do that a “Missing required configuration variable” error. My searches in the docs and in code on github have come up with nothing. Figured I’d ask before diving into SDK source code.sticky-bear-14421
11/10/2021, 2:49 PMabundant-book-94104
11/12/2021, 1:44 AMfresh-actor-58531
11/17/2021, 6:46 AMfresh-actor-58531
11/17/2021, 6:50 AMimportant-magician-41327
11/17/2021, 9:27 AMimportant-magician-41327
11/18/2021, 9:50 AMfierce-market-67222
11/19/2021, 7:01 AMFailed to resolve python version command: fork/exec bin/python: no such fie or directory
full-sugar-56177
11/19/2021, 11:47 AMlb_sg = aws.ec2.get_security_group(
tags={"Name": "my-lb"}"
)
sg = aws.ec2.SecurityGroup(
"web-lb",
vpc_id=vpc_id,
description="Enable HTTP access from Load Balancer",
ingress=[
aws.ec2.SecurityGroupIngressArgs(
protocol="tcp",
from_port=args.port,
to_port=args.port,
cidr_blocks=[lb_sg.id)],
)
],
egress=[
aws.ec2.SecurityGroupEgressArgs(
protocol="-1",
from_port=0,
to_port=0,
cidr_blocks=["0.0.0.0/0"],
)
],
)
important-magician-41327
11/22/2021, 11:22 AMimport pulumi
import pulumi_aws as aws
main = aws.ec2.Subnet("main",
vpc_id=aws_vpc["main"]["id"],
cidr_block="10.0.1.0/24",
tags={
"Name": "Main",
})
Unfortunately specify the name of the resource does not work in my case, what Do I miss?
#Create VPC
vpc = aws.ec2.Vpc("vpc_1",
cidr_block="10.0.1.0/24",
)
vpc = aws.ec2.Vpc("vpc_2",
cidr_block="10.0.2.0/24",
)
#create WANem subnet
subnet_vpc1 = aws.ec2.Subnet("vpc_1",
vpc_id=vpc["vpc_1"].id,
cidr_block="10.0.1.0/24",
availability_zone=available.names[0],
)
#create WANem subnet
subnet_vpc2 = aws.ec2.Subnet("vpc_2",
vpc_id=vpc["vpc_2"].id,
cidr_block="10.0.2.0/24",
availability_zone=available.names[0],
)
My goal is to reference the VPC by the name, not by object. How can I do this?important-magician-41327
11/23/2021, 7:51 AMbulky-policeman-29913
11/24/2021, 4:16 PMbulky-policeman-29913
11/24/2021, 4:18 PMnutritious-shampoo-16116
11/25/2021, 3:09 PMRuntimeError: Task <Task pending name='Task-63' coro=<run_pulumi_func() running at /home/$USER/.local/share/virtualenvs/cmw2Vtk-i/lib/python3.9/site-packages/pulumi/runtime/stack.py:45> cb=[_run_until_complete_cb() at /usr/lib/python3.9/asyncio/base_events.py:184]> got Future <Task pending name='Task-760' coro=<get_resource.<locals>.do_get() running at /home/$USER/.local/share/virtualenvs/cmw2Vtk-i/lib/python3.9/site-packages/pulumi/runtime/resource.py:231> cb=[<TaskWakeupMethWrapper object at 0x7f8f73b7fdc0>()]> attached to a different loop
any idea?nutritious-shampoo-16116
11/25/2021, 3:11 PMnutritious-shampoo-16116
11/25/2021, 3:38 PMself = <pulumi.runtime.mocks.MockMonitor object at 0x7f0727a5ee80>
request = tok: "pulumi:pulumi:getResource"
args {
fields {
key: "urn"
value {
string_value: "urn:pulumi:dev::totoro::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::dvusea1-totoro-priv-route-table"
}
}
}
def Invoke(self, request):
# Ensure we have an event loop on this thread because it's needed when deserializing resource references.
_ensure_event_loop()
args = rpc.deserialize_properties(request.args)
if request.tok == "pulumi:pulumi:getResource":
registered_resource = self.resources.get(args["urn"])
if registered_resource is None:
> raise Exception(f"unknown resource {args['urn']}")
E Exception: unknown resource urn:pulumi:dev::totoro::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::dvusea1-totoro-priv-route-table
this the exception I am seeingnutritious-shampoo-16116
11/25/2021, 3:40 PMabundant-book-94104
11/26/2021, 1:27 AMimportant-magician-41327
11/29/2021, 8:56 AMRegion:
+ VPC
+ IGW
Site
- VPC(region A)
- IGW (region A)
+ Subnet
+ Route Table
Site Type A
- VPC(region A)
- IGW (region A)
- Subnet (site 1)
- Route Table (site 1)
+ EC2
Site Type B
- VPC(region A)
- IGW (region A)
- Subnet (site 1)
- Route Table (site 1)
+ ECK
In the above example, resources in Region A is provisioned by the Region Class. The Site Class will import these resources and configure additional resources. Site Type A will import everything from Site 1 and configure some additional resources like EC2 or ECK.
How should I structure this with Python Inheritance and Composition?prehistoric-beach-79855
11/30/2021, 4:59 PMworried-xylophone-86184
12/01/2021, 7:13 PMxyz:index:StaticPage
) , to something like company_name:module_name:resource_name
. But whenever I name it something apart from index
I end up getting this stack trace mentioned in the thread. Can someone help me out with this? I might be missing something obviousgorgeous-minister-41131
12/02/2021, 9:55 PMuse1
or usw2
?nutritious-shampoo-16116
12/03/2021, 1:30 PMnutritious-shampoo-16116
12/03/2021, 1:37 PMgorgeous-minister-41131
12/03/2021, 8:54 PMminiature-oxygen-33318
12/06/2021, 11:24 AMbreezy-painter-29573
12/06/2021, 9:45 PMdef container_definition(image_name, service, env_variables):
print("service:",service)
print("env_vars:", env_variables)
return json.dumps([{
'name': 'server',
'image': image_name,
'networkMode': 'awsvpc',
'readonlyRootFilesystem': False,
'essential': True,
'environment': env_variables,
..... Non relevant code continues
}])
for service in config.common_config['services']:
env_variables.append({'name': 'SERVICES', 'value': service})
if service != 'frontend':
env_variables.append({'name': 'TEMPORAL_CLI_ADDRESS',
'value': f'{config.common_config["frontend"]["service_name"]}.{config.common_config["dns_namespace"]}'})
task_definitions[service] = aws.ecs.TaskDefinition(config.common_config[service]['service_name'],
family=config.common_config[service]['service_name'],
cpu=config.common_config[service]['cpu'],
memory=config.common_config[service]['memory'],
network_mode='awsvpc',
requires_compatibilities=['FARGATE'],
execution_role_arn=ecs_task_role.arn,
task_role_arn=ecs_task_role.arn,
container_definitions=image.image_name.apply(
lambda image_name: container_definition(image_name, service, env_variables)),
tags={
"Service": "temporal",
},
opts=ResourceOptions(depends_on=[log_group]))
When it is executed for the container_definitions in preview I am seeing env_variables with duplicates and service
is set to the latest in the list of config.common_config['services']
. I do believe it is somehow related to the nature of "Promised" Output, but not an expert in Python enough to catch and fix it.
TIA!
Everything worked properly in the loop until I needed to add image name for ECR 😄