Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix codegen ignoring "plain": true fields in Args schemas #506

Open
lbialy opened this issue May 26, 2024 · 0 comments
Open

Fix codegen ignoring "plain": true fields in Args schemas #506

lbialy opened this issue May 26, 2024 · 0 comments
Assignees
Labels
area/api User visible API area/codegen Schema to code generator impact/breaking Fixing this issue will require a breaking change impact/reliability Something that feels unreliable or flaky kind/bug Some behavior is incorrect or out of spec P2 Bugs of moderate severity to be assigned to an engineer in the next iteration size/M Estimated effort to complete (up to 5 days).
Milestone

Comments

@lbialy
Copy link
Collaborator

lbialy commented May 26, 2024

Our codegen currently ignores modifier "plain": true in args schemas which is apparently used to mark fields that are not dynamic and have to be provided statically. Here's an example of VpcArgs in ts awsx:

export interface VpcArgs {
    /**
     * Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is `false`. Conflicts with `ipv6_ipam_pool_id`
     */
    assignGeneratedIpv6CidrBlock?: pulumi.Input<boolean>;
    /**
     * The netmask for each available zone to be aligned to. This is optional, the default value is inferred based on an even distribution of available space from the VPC's CIDR block after being divided evenly by the number of availability zones.
     */
    availabilityZoneCidrMask?: number;
    /**
     * A list of availability zone names to which the subnets defined in subnetSpecs will be deployed. Optional, defaults to the first 3 AZs in the current region.
     */
    availabilityZoneNames?: string[];
    /**
     * The CIDR block for the VPC. Optional. Defaults to 10.0.0.0/16.
     */
    cidrBlock?: string;
    /**
     * A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
     */
    enableDnsHostnames?: pulumi.Input<boolean>;

And relevant schema definition:

            "inputProperties": {
               "assignGeneratedIpv6CidrBlock": {
                   "type": "boolean",
                   "description": "Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is `false`. Conflicts with `ipv6_ipam_pool_id`\n"
               },
               "availabilityZoneCidrMask": {
                   "type": "integer",
                   "plain": true,
                   "description": "The netmask for each available zone to be aligned to. This is optional, the default value is inferred based on an even distribution of available space from the VPC's CIDR block after being divided evenly by the number of availability zones."
               },
               "availabilityZoneNames": {
                   "type": "array",
                   "items": {
                       "type": "string",
                       "plain": true
                   },
                   "plain": true,
                   "description": "A list of availability zone names to which the subnets defined in subnetSpecs will be deployed. Optional, defaults to the first 3 AZs in the current region."
               },
               "cidrBlock": {
                   "type": "string",
                   "plain": true,
                   "description": "The CIDR block for the VPC. Optional. Defaults to 10.0.0.0/16."
               },
               "enableDnsHostnames": {
                   "type": "boolean",
                   "description": "A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.\n"
               },

Each field marked with plain: true is not wrapped in Input here and this means there's no way to provide an Output-wrapped value for it - it has to be known statically (or user has to make the whole resource part of a dynamic tree and create it in apply (our map/flatMap) lambda). This property is upheld when resources are used in multi-language components (MLC) - in this case AWSx and EKS and Besom breaks the expectation by sending an Output due to keep outputs / outputValues feature support (we send an output on wire protocol, serde on receiving side deserializes it correctly as OutputValue but then the whole code expects it to be a plain type, not a wrapped one so it explodes like in #493 (this is the cause of this issue).

@lbialy lbialy added kind/bug Some behavior is incorrect or out of spec area/codegen Schema to code generator size/M Estimated effort to complete (up to 5 days). area/api User visible API impact/breaking Fixing this issue will require a breaking change impact/reliability Something that feels unreliable or flaky P2 Bugs of moderate severity to be assigned to an engineer in the next iteration labels May 26, 2024
@lbialy lbialy added this to the 0.4.0 milestone May 26, 2024
@PawelGizka PawelGizka self-assigned this Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api User visible API area/codegen Schema to code generator impact/breaking Fixing this issue will require a breaking change impact/reliability Something that feels unreliable or flaky kind/bug Some behavior is incorrect or out of spec P2 Bugs of moderate severity to be assigned to an engineer in the next iteration size/M Estimated effort to complete (up to 5 days).
Projects
None yet
Development

No branches or pull requests

2 participants