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

WIP: try to fix dangling references in the schema #4467

Closed
wants to merge 4 commits into from

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Sep 17, 2024

No description provided.

@@ -188,4 +188,11 @@ func init() {
resourceOverlays[callbackFunctionTok] = callbackFunction

typeOverlays[codePathOptionsTok] = codePathOptions

typeOverlays["aws:index/aRN:ARN"] = schema.ComplexTypeSpec{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an attempt to register an overlay-only type with the schema, hoping that Node SDK would be able to recognize references and other SDK would ignore it.


// Fix a dangling type reference to a resolved resource reference.
f := spec.Resources["aws:cloudwatch/logSubscriptionFilter:LogSubscriptionFilter"]
f.InputProperties["logGroup"].OneOf[1].Ref = "#/resources/aws:cloudwatch/logGroup:LogGroup"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes a dangilng type reference to an actually correct resource reference.

},

Config: map[string]*tfbridge.SchemaInfo{
"assume_role": {
MaxItemsOne: tfbridge.True(),
},
"region": {
Type: awsTypeDefaultFile(awsMod, "Region"),
Type: "aws:index/Region:Region",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now points to the official enum for region. Highlighing here because region is one of the most impactful potentially breaking changes from the lot.

@@ -1235,7 +1239,7 @@ compatibility shim in favor of the new "name" field.`)
AltTypes: []tokens.Type{awsResource(ec2Mod, "PlacementGroup")},
},
"enabled_metrics": {
Elem: &tfbridge.SchemaInfo{Type: awsType(autoscalingMod, "metrics", "Metric")},
Elem: &tfbridge.SchemaInfo{Type: awsType(autoscalingMod, "Metric", "Metric")},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A dangling reference is replaced with an actual reference to a real enum here, as one possibility to fix the problem. The other possibility would be to introduce a IsOverlay entry for the previous dangling reference.

@@ -163,7 +164,7 @@ type Topic struct {
// The message archive policy for FIFO topics. More details in the [AWS documentation](https://docs.aws.amazon.com/sns/latest/dg/message-archiving-and-replay-topic-owner.html).
ArchivePolicy pulumi.StringPtrOutput `pulumi:"archivePolicy"`
// The ARN of the SNS topic, as a more obvious property (clone of id)
Arn pulumi.StringOutput `pulumi:"arn"`
Arn aws.ARNOutput `pulumi:"arn"`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking

@@ -259,7 +260,7 @@ type topicState struct {
// The message archive policy for FIFO topics. More details in the [AWS documentation](https://docs.aws.amazon.com/sns/latest/dg/message-archiving-and-replay-topic-owner.html).
ArchivePolicy *string `pulumi:"archivePolicy"`
// The ARN of the SNS topic, as a more obvious property (clone of id)
Arn *string `pulumi:"arn"`
Arn *aws.ARN `pulumi:"arn"`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking

/**
* The region where AWS operations will take place. Examples are us-east-1, us-west-2, etc.
*/
public readonly region!: pulumi.Output<Region | undefined>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's suspect that this got removed. It should not have been removed probably.

@@ -214,7 +208,7 @@ export interface ProviderArgs {
/**
* The region where AWS operations will take place. Examples are us-east-1, us-west-2, etc.
*/
region?: pulumi.Input<Region>;
region?: pulumi.Input<enums.Region>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly breaking - the type is compatible but it moved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant