https://pulumi.com logo
#aws
Title
# aws
p

purple-mouse-61376

01/25/2021, 3:07 AM
Hi everyone! I'm trying to create an EKS cluster with an existing VPC, but I'm getting and error that
vpc_config
is an unexpected keyword argument. Here's the code for the class I'm making which extends the eks.Cluster class:
Copy code
class AwsEks(eks.Cluster):
    def __init__(self, name='', policy_statement=None, **kwargs):
        if name:
            asset_key = f"{name}-eks"
        else:
            asset_key = "eks"

        self.asset_name = f"{environment}-{asset_key}"

        self._role = AwsRole(
            service="<http://eks.amazonaws.com|eks.amazonaws.com>",
            name=asset_key
        )

        self.vpc_config = ClusterVpcConfigArgs(
            subnet_ids = SUBNET_IDS
            vpc_id = VPC_ID
        )

        if policy_statement:
            self._policy = AwsPolicy(
                name=asset_key,
                policy_statement=policy_statement
                )

            self.policy_attachment = AwsPolicyAttachment(
                role_name=self._role.name,
                policy_arn=self._policy.arn,
                name=asset_key
            )

        super().__init__(
            resource_name=self.asset_name,
            name=self.asset_name,
            vpc_config = self.vpc_config,
            role=self._role.arn,
            **kwargs
        )

        export(self.asset_name, self.id)
And the error:
Copy code
TypeError: __init__() got an unexpected keyword argument 'vpc_config'
Using this for reference: https://www.pulumi.com/docs/reference/pkg/aws/eks/cluster/#create
Copy code
def Cluster(
  resource_name: str,
  opts: Optional[ResourceOptions] = None,
  enabled_cluster_log_types: Optional[Sequence[str]] = None,
  encryption_config: Optional[ClusterEncryptionConfigArgs] = None,
  kubernetes_network_config: Optional[ClusterKubernetesNetworkConfigArgs] = None,
  name: Optional[str] = None,
  role_arn: Optional[str] = None,
  tags: Optional[Mapping[str, str]] = None,
  version: Optional[str] = None,
  vpc_config: Optional[ClusterVpcConfigArgs] = None
)
b

billowy-army-68599

01/25/2021, 3:20 AM
could you open an issue for this in the pulumi/pulumi-eks repo so we can triage it?
just what you've posted here would be great!
p

purple-mouse-61376

01/25/2021, 3:20 AM
okay I'll do that now! 😄
4 Views