diff --git a/www/src/content/docs/docs/components.mdx b/www/src/content/docs/docs/components.mdx index 69f1c2fa7..debdfa073 100644 --- a/www/src/content/docs/docs/components.mdx +++ b/www/src/content/docs/docs/components.mdx @@ -409,40 +409,44 @@ Read more about [`$resolve`](/docs/reference/global/#resolve). ## Versioning -SST components evolve over time, sometimes introducing breaking changes. To maintain backward compatibility, we implement component versioning. +SST components evolve over time, sometimes introducing breaking changes. To maintain backwards compatibility, we implement a component versioning scheme. -By default, the deployment process will raise an error if a component's version has been updated. This ensures you're aware of potential breaking changes before they affect your application. +For example, we released a new version the [`Vpc`](component/aws/vpc) that does not create a NAT Gateway by default. To roll this out the previous version of the `Vpc` component was renamed to [`Vpc.v1`](component/aws/vpc-v1). ---- +Now if you were using the original `Vpc` component, update SST, and deploy; you'll get an error during the deploy saying that there's a new version of this component. -#### Use a previous version +This allows you to decide what you want to do with this component. -If you prefer to continue using a previous version of a component, you can pin it explicitly: +--- -```ts -const vpc = new sst.aws.Vpc.v1("MyVpc"); +#### Continue with the old version -new sst.aws.Function("MyFunction", { - handler: "src/lambda.handler", - vpc -}) +If you prefer to continue using the older version of a component, you can rename it. + +```diff title="sst.config.ts" lang="ts" +- const vpc = new sst.aws.Vpc("MyVpc"); ++ const vpc = new sst.aws.Vpc.v1("MyVpc"); ``` +Now if you deploy again, SST knows that you want to stick with the old version and it won't error. + --- #### Update to the latest version -To update to the latest version of a component, you need to rename the component. This process removes the previously created component and recreates it with the new name and the latest version. +Instead, if you wanted to update to the latest version, you'll have to rename the component. -```ts -const vpc = new sst.aws.Vpc("NewVpc"); - -new sst.aws.Function("MyFunction", { - handler: "src/lambda.handler", - vpc -}) +```diff title="sst.config.ts" lang="ts" +- const vpc = new sst.aws.Vpc("MyVpc"); ++ const vpc = new sst.aws.Vpc("MyNewVpc"); ``` +Now if you redeploy, it'll remove the previously created component and recreate it with the new name and the latest version. + +This is because from SST's perspective it looks like the `MyVpc` component was removed and a new component called `MyNewVpc` was added. + :::caution -Replacing components may cause temporary downtime in your application. +Removing and recreating components may cause temporary downtime in your app. ::: + +Since these are being recreated you've to be aware that there might be a period of time when that resource is not around. This might cause some downtime, depending on the resource.