Skip to content

(Amazon.CDK.AWS.EKS.CfnCluster): Documentation sample does not work as shown #3930

Open
@cchostak

Description

@cchostak

link to reference doc page

https://docs.aws.amazon.com/cdk/api/v1/dotnet/api/Amazon.CDK.AWS.EKS.CfnCluster.html

Describe your issue?

.csproj


  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp5</TargetFramework>
    <!-- Roll forward to future major versions of the netcoreapp as needed -->
    <RollForward>Major</RollForward>
  </PropertyGroup>

  <ItemGroup>
    <!-- CDK Construct Library dependencies -->
    <PackageReference Include="Amazon.CDK.Lib" Version="2.17.0" />
    <PackageReference Include="Constructs" Version="[10.0.0,11.0.0)" />

    <!-- jsii Roslyn analyzers (un-comment to obtain compile-time checks for missing required props
    <PackageReference Include="Amazon.Jsii.Analyzers" Version="*" PrivateAssets="all" />
    -->
  </ItemGroup>

</Project>

EksCdkStack.cs

... boilerplate
            CfnCluster cfnCluster = new CfnCluster(this, Constants.CLUSTER_PREFIX, new CfnClusterProps
            {
                ResourcesVpcConfig = new ResourcesVpcConfigProperty
                {
                    SubnetIds = new[] { combinedSubnets },
                    EndpointPrivateAccess = isClusterPublic ? false : true,
                    EndpointPublicAccess = isClusterPublic ? true : false,
                },
                RoleArn = clusterAdmin.RoleArn,
                Name = clusterName.ValueAsString,
                Version = clusterVersion.ValueAsString
            });
... boilerplate

Documentation clearly states that we can use 'ResourcesVpcConfig = new ResourcesVpcConfigProperty', but:

  • not using ResourcesVpcConfigProperty, I receive the error (cool, as expected):
Unhandled exception. Amazon.JSII.Runtime.JsiiException: Missing required properties for aws-cdk-lib.aws_eks.CfnClusterProps: resourcesVpcConfig
  • using ResourcesVpcConfigProperty, it shows me:
The type or namespace name 'ResourcesVpcConfigProperty' could not be found (are you missing a using directive or an assembly reference?
  • using ResourcesVpcConfig, it shows me:
The type or namespace name 'ResourcesVpcConfig' could not be found (are you missing a using directive or an assembly reference?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationThis is a problem with documentation.feature-requestA feature should be added or improved.jsiilanguage/dotnetRelated to .NET bindings (C#, F#, ...)p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions