delightful-queen-14969
09/20/2025, 3:54 AMdelightful-queen-14969
09/20/2025, 8:35 AMpulumi.Output[str] value for a CIDR block in one of the configuration values for an ingress rule, instead of just setting the cidr block setting as an Output, it appears that the entire ingress_rules setting gets turned into a pulumi.Output
So I have code like this defining my component (omitting the pydantic model configs that allow it to accept arbitrary types and all that):
import pydantic
...
class EC2SecurityGroupIngressRule(pydantic.BaseModel):
"""Config for an AWS EC2 Security Group ingress rule."""
...
ipv4_cidr_block: Input[str] | None = None
"""The IPv4 CIDR block this rule applies to."""
class EC2SecurityGroupArgs(pydantic.BaseModel):
"""Config for an AWS EC2 Security Group."""
...
ingress_rules: Mapping[str, EC2SecurityGroupIngressRule] | None = None
"""The ingress rules for the security group."""
Instead of getting a Mapping, I'm getting a pulumi.Output for ingress_rules and I know this because Pydantic says so:
error: custom:index:EC2SecurityGroup resource 'my-group' has a problem: Unexpected <class 'Exception'>: 1 validation error for EC2SecurityGroupArgs
ingress_rules
Input should be a valid dictionary [type=dict_type, input_value=<pulumi.output.Output object at 0x7ff549a22c40>, input_type=Output]
For further information visit <https://errors.pydantic.dev/2.11/v/dict_type>:
...
I have tried recreating this issue using TypedDicts but the amount of work it takes to recreate all of the moving bits is monumental and I don't want to have to give up type safety and model validators to easily set defaults just to be able to write multi-language components.delightful-queen-14969
09/20/2025, 8:39 AMmy_security_group = EC2SecurityGroup(
f"{resource_id}-something",
args=EC2SecurityGroupArgs(
name=f"vpc-{resource_id}-my-endpoint",
description="Security group for my endpoint",
ingress_rules={
"https": EC2SecurityGroupIngressRuleArgs(
name="https",
protocol=EC2SecurityGroupRuleProtocol.TCP,
from_port=443,
to_port=443,
ipv4_cidr_block=vpc.ipv4_cidr_block, <--- This is an Output[str]
description="Allow HTTPS access",
),
},
vpc_id=vpc.vpc_id,
),
)
It's not like I am wrapping this argument in an apply() call or something, so I have absolutely no idea what I could possibly be doing here to even end up in the situation where I have an output for this value. It just doesn't make any sense and I can't see anything super obvious that I have done wrong on my sidemicroscopic-translator-29895
09/21/2025, 10:44 AMmicroscopic-translator-29895
09/21/2025, 10:44 AMdelightful-queen-14969
09/21/2025, 10:46 AMdelightful-queen-14969
09/21/2025, 10:49 AMmicroscopic-translator-29895
09/21/2025, 11:13 AMmicroscopic-translator-29895
09/21/2025, 11:14 AMdelightful-queen-14969
09/21/2025, 11:46 AMdelightful-queen-14969
09/21/2025, 11:46 AMmicroscopic-translator-29895
09/21/2025, 1:18 PMmicroscopic-translator-29895
09/21/2025, 1:19 PMdelightful-queen-14969
09/21/2025, 2:31 PMdelightful-queen-14969
09/21/2025, 10:02 PMdelightful-queen-14969
09/22/2025, 3:53 AMdelightful-queen-14969
09/22/2025, 4:51 AMNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by