great-sunset-355
12/22/2021, 9:37 AMapply()
when using this code?
# vpc endpoints
vpc_endpoints = ["s3", "ecr.dkr", "ecr.api", "logs"]
region_output = self._config.aws_provider.region
for endpoint in vpc_endpoints:
service_name = region_output.apply(
lambda region: f"com.amazonaws.{region}.{endpoint}" # endpoint here does not update from the loop variable
)
pulumi_aws.ec2.VpcEndpoint(
f"{self._config.name}-{endpoint}-vpc-endpoint",
args=pulumi_aws.ec2.VpcEndpointArgs(
service_name=service_name,
vpc_id=self.vpc.id,
tags=self._config.tags,
),
opts=self._opts,
)
billowy-army-68599
great-sunset-355
12/22/2021, 9:41 AMvpc.id
is not a problem, the problem comes from the region
assigned in svc = ...
vpc_endpoints
list
serviceName: "com.amazonaws.eu-central-1.s3" => "com.amazonaws.eu-central-1.logs"
Outpu.concat
instead of the apply
it is way less readable but it works