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

Nested properties are not merged when doing a partial transform #581

Open
lukeshay opened this issue Jun 20, 2024 · 0 comments
Open

Nested properties are not merged when doing a partial transform #581

lukeshay opened this issue Jun 20, 2024 · 0 comments
Assignees

Comments

@lukeshay
Copy link
Contributor

When you pass a partial object to the transform field, the objects are not merged. For example, if you try to add an inline policy to a role, it does not get merged with the inline policies ion is adding. This is because the args and the transform object are spread and not merged. This line should do a deep merge and concat.

Example

sst.config.ts:

const table = new sst.aws.Table("Table");

// The inline policies array is overwritten so the policies that were added for the table are not there
new sst.aws.Function("Function", {
  link: [table],
  transform: {
    function: {
      tracingConfig: {
        mode: "Active",
      },
    },
    role: {
      inlinePolicies: [
        {
          name: "XRayPolicy",
          policy: $util.jsonStringify({
          Version: "2012-10-17",
            Statement: [
              {
                Effect: "Allow",
                Action: [
                  "xray:PutTraceSegments",
                  "xray:PutTelemetryRecords",
                ],
                Resource: "*",
              },
            ],
          }),
        },
      ],
    },
  },
});
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

No branches or pull requests

2 participants