pulumi / pulumi-aws-native

AWS Native Provider for Pulumi
Apache License 2.0
93 stars 17 forks source link

ReplaceOnChanges not set for nested properties #1706

Open t0yv0 opened 1 week ago

t0yv0 commented 1 week ago

What happened?

It looks like there is some existing code around markCreateOnlyProperty that is incomplete with respect to nested properties.

https://github.com/pulumi/pulumi-aws-native/blob/master/provider/pkg/schema/gen.go#L667

Example

Consider AWS::LookoutMetrics::AnomalyDetector example.

AWS CF schema specifies:

  "createOnlyProperties" : [ "/properties/AnomalyDetectorName", "/properties/MetricSource" ],

However this is not a top-level property. It's an object under definitions:

    "MetricSource" : {
      "type" : "object",
      "properties" : {
        "S3SourceConfig" : {
          "$ref" : "#/definitions/S3SourceConfig"
        },
        "RDSSourceConfig" : {
          "$ref" : "#/definitions/RDSSourceConfig"
        },
        "RedshiftSourceConfig" : {
          "$ref" : "#/definitions/RedshiftSourceConfig"
        },
        "CloudwatchConfig" : {
          "$ref" : "#/definitions/CloudwatchConfig"
        },
        "AppFlowConfig" : {
          "$ref" : "#/definitions/AppFlowConfig"
        }
      },
      "additionalProperties" : false
    },

Used as a nested declaration of another property:

    "MetricSet" : {
      "type" : "object",
      "properties" : {
        "MetricSource" : {
          "$ref" : "#/definitions/MetricSource"
        },

Currently make local_generate started failing catastrophically on encountering this. To workaround the problem, I will temporarily introduce a patch to ignore these failures, but we possibly need to revisit later on for completeness.

AFAIK replaceOnChanges property in the schema is of a documentation value at the moment and does not affect the actual behavior of the provider, but this may change.

Output of pulumi about

N/A

Additional context

N/A

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

t0yv0 commented 1 week ago

Turns out I was mistaken, this is a warning and not a fatal error so it is simply a nice-to-have.