I'm sure I'm missing something pretty simple here,...
# general
I'm sure I'm missing something pretty simple here, but I can't seem to figure it out or find an answer online. I'm working with an existing EKS cluster and trying import it into Pulumi. I'm using aws-native in Python. The EKS Cluster Resource takes a VPC config. A few of the VPC config properties are arrays, security_group_ids, public_access_cidrs, and subnet_ids are the ones I'm interested in. As I'm importing it, I don't (yet) want to mess with having Pulumi take over the subnets and security groups. So, I'm treating their values as config. As such, I have:
Copy code
  - "sg-id"
  - "subnet-1"
  - "subnet-2"
In my stack yaml. I have:
Copy code
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
Copy code
vpc_config = pulumi_aws_native.eks.ClusterResourcesVpcConfigArgs(
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. Thanks
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")
You may also need to cast it to give a strong hint to the type checker: https://docs.python.org/3/library/typing.html#typing.cast
It's better to use
too if you expect the config to always be set
Thanks for the pointers, I ended up with
cast(Sequence[str], config.cluster_subnet_ids)