pulumi-aws: Invalid references in Pulumi package schema
@davidspielmann and I recently started looking deeper into Pulumi package schemas and bumped into some issues with named types/references in the schema of the aws classic provider. Talking about it at PulumiUP, @mnlumi encouraged us to share our insight. Perhaps it can help to get some of the references fixed with the upcoming 6.0 release 😃
Background: Pulumi package schemas include “Named Types”, which are references (a URI string) to a type specification. Our understanding of how these URIs are resolved from the $ref field is https://github.com/pulumi/pulumi/blob/master/pkg/codegen/schema/schema.go#L1409-L1416
Valid references are the built-in types pulumi.json#/Archive, pulumi.json#/Asset, pulumi.json#/Any, and pulumi.json#/Json. All other references have the format [origin]#/{resources,types}/[urn] where [origin] is the file path or URL of a schema file (empty for in-document references) and [urn] the identifier of the respective type definition under “resources” or “types” in that schema.
Expectation: All references in a package schema can be resolved. However, 168 references (25 URIs) in the schema of aws@5.41.0 cannot be resolved as defined above. These are the non-resolvable URIs we found; some of them are also noted in other GH issues (referenced).
These 77 references (15 URIs) cannot be resolved but are valid resources, i.e., they could be resolved when prefixing with #/resources/:
aws:apigateway/deployment:Deployment(2 occurrences)aws:apigateway/restApi:RestApi(24 occurrences)aws:cloudwatch/logGroup:LogGroup(2 occurrences)aws:ec2/launchConfiguration:LaunchConfiguration(2 occurrences)aws:ec2/placementGroup:PlacementGroup(2 occurrences)aws:elasticbeanstalk/application:Application(4 occurrences)aws:elasticbeanstalk/applicationVersion:ApplicationVersion(3 occurrences) https://github.com/pulumi/pulumi-aws/issues/2358aws:iam/group:Group(4 occurrences)aws:iam/instanceProfile:InstanceProfile(4 occurrences)aws:iam/role:Role(8 occurrences) https://github.com/pulumi/pulumi-aws/issues/1820aws:iam/user:User(4 occurrences)aws:iot/policy:Policy(2 occurrences)aws:lambda/function:Function(2 occurrences)aws:s3/bucket:Bucket(6 occurrences)aws:sns/topic:Topic(8 occurrences)
These 21 references (5 URIs) cannot be resolved but are valid types if treated case-insensitive, i.e., they could be resolved when ignoring the case and prefixing with #/types/:
aws:alb/ipAddressType:IpAddressType(6 occurrences) https://github.com/pulumi/pulumi-aws/issues/2362aws:alb/loadBalancerType:LoadBalancerType(6 occurrences) https://github.com/pulumi/pulumi-aws/issues/2362aws:autoscaling/notificationType:NotificationType(3 occurrences)aws:index/region:Region(3 occurrences) https://github.com/pulumi/pulumi-aws/issues/2463aws:rds/engineType:EngineType(3 occurrences)
These 70 references (5 URIs) cannot be resolved and we did not find a way to fix it:
aws:autoscaling/metrics:Metric(3 occurrences)aws:ecr/lifecyclePolicyDocument:LifecyclePolicyDocument(2 occurrences)aws:iam/documents:PolicyDocument(22 occurrences)aws:index/aRN:ARN(42 occurrences) https://github.com/pulumi/pulumi-aws/issues/1682aws:s3/routingRules:RoutingRule(1 occurrences)
This is the Python notebook we used for this analysis. It also applies the analyis to aws-native@0.65.0, akamai@4.4.0, alicloud@3.38.0, azure@5.44.0, azure-native@1.103.0, azure-native@v2.0.0-beta.1, cloudflare@5.3.0, gcp@6.58.0, google-native@0.30.0, hcloud@1.12.1, kubernetes@3.29.1, random@4.13.2. For most of them, all references are fine, with minimal exceptions (which, ideally, also would be fixed). https://gist.github.com/DSoko2/4630a14c97a9469385dceed0ab07bc1f
We hope this helps to improve this provider’s schema, i.e, eliminate workarounds and non-resolvable URIs. If you should have questions or we can help somehow, please let us know.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 2
- Comments: 18 (14 by maintainers)
Commits related to this issue
- Compute schema-minimal.json (#4587) Perform automatic rewrites over the schema to remove dangling type references and produce a minimal schema for tool consumption that is distinct from the real sc... — committed to pulumi/pulumi-aws by t0yv0 2 years ago
- [v7]: Remove remaining dangling schema references (#5582) This PR removes the remaining dangling references. - `EngineType` had the wrong casing (fixed) - `LifecyclePolicyDocument` similar to #5565 ... — committed to pulumi/pulumi-aws by corymhall a year ago
That won’t be necessary. Looks like I got the tag references wrong, apologies, https://github.com/pulumi/pulumi-aws/pull/4587 did not make it into the 6.55.0 release yet. We will be releasing with the next minor update (building that now https://github.com/pulumi/pulumi-aws/pull/4638) and I will double check that get-schema works.
I was expecting this to work but verifying on latest it seems that it is not working properly. I’ll have closer look.
Further discussion with @mikhailshilkov we are contemplating the possibility to construct two schemas for the moment. One schema similar to the present schema will be used for the purposes of:
The second variation of the schema will have all overlay types stripped down, not have any dangling references, and accurately describe non-Node SDKs.
This scheme can unblock use cases until we are able to achieve full unification in v-next.