helpful-continent-37250
11/17/2023, 3:45 PMproject:cluster_security_group_ids:
- "sg-id"
project:cluster_subnet_ids:
- "subnet-1"
- "subnet-2"
In my stack yaml.
I have:
config = pulumi.Config()
cluster_security_group_ids = config.get_object("cluster_security_group_ids")
cluster_subnet_ids = config.get_object("cluster_subnet_ids")
in my Pulumi Program.
I am then using those values in my VPC config
vpc_config = pulumi_aws_native.eks.ClusterResourcesVpcConfigArgs(
endpoint_private_access=False,
endpoint_public_access=True,
security_group_ids=cluster_security_group_ids,
public_access_cidrs=cluster_ip_whitelist,
subnet_ids=cluster_subnet_ids,
)
This yields a type error of
> Argument of type "Any | None" cannot be assigned to parameter "subnet_ids" of type "Input[Sequence[Input[str]]]" in function "__init__"
However, the same approach works for security_group_ids.
Any pointers/help would be appreciated.
Thanksdry-keyboard-94795
11/17/2023, 4:31 PMget_object
isn't strongly typed, as it can be used to get a variety of different types.
It's a type hint error, so doesn't block runtime code.
To fix, you need to let your code know what the object will be by doing:
subnet_ids: list[str] = config.get_object("subnet_ids")
require_object
too if you expect the config to always be sethelpful-continent-37250
11/17/2023, 10:04 PMcast(Sequence[str], config.cluster_subnet_ids)