Skip to content

Commit

Permalink
vpc: new version (v2)
Browse files Browse the repository at this point in the history
commit 0284340
Author: Frank <[email protected]>
Date:   Wed Aug 14 18:02:05 2024 -0400

    sync

commit 4fb3ef6
Author: Dax Raad <[email protected]>
Date:   Wed Aug 14 13:28:24 2024 -0400

    implement versions

commit 499cb05
Author: Frank <[email protected]>
Date:   Wed Aug 14 12:50:41 2024 -0400

    sync
  • Loading branch information
fwang committed Aug 14, 2024
1 parent 2ca3a18 commit 1dfb590
Show file tree
Hide file tree
Showing 26 changed files with 1,529 additions and 181 deletions.
3 changes: 2 additions & 1 deletion cmd/sst/mosaic/ui/footer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"fmt"
"os"
"slices"
"strings"
"time"

Expand Down Expand Up @@ -176,7 +177,7 @@ func (m *footer) Update(msg any) {
m.Reset()
break
case *apitype.ResourcePreEvent:
if msg.Metadata.Type == "pulumi:pulumi:Stack" || msg.Metadata.Type == "sst:sst:LinkRef" {
if slices.Contains(IGNORED_RESOURCES, msg.Metadata.Type) {
break
}
if msg.Metadata.Old != nil && msg.Metadata.Old.Parent != "" {
Expand Down
9 changes: 6 additions & 3 deletions cmd/sst/mosaic/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log/slog"
"net/url"
"os"
"slices"
"strings"
"time"
"unicode"
Expand All @@ -25,6 +26,8 @@ import (

type ProgressMode string

var IGNORED_RESOURCES = []string{"sst:sst:Version", "sst:sst:LinkRef", "pulumi:pulumi:Stack"}

const (
ProgressModeDeploy ProgressMode = "deploy"
ProgressModeRemove ProgressMode = "remove"
Expand Down Expand Up @@ -207,7 +210,7 @@ func (u *UI) Event(unknown interface{}) {

case *apitype.ResourcePreEvent:
u.timing[evt.Metadata.URN] = time.Now()
if evt.Metadata.Type == "pulumi:pulumi:Stack" || evt.Metadata.Type == "sst:sst:LinkRef" {
if slices.Contains(IGNORED_RESOURCES, evt.Metadata.Type) {
return
}

Expand All @@ -227,7 +230,7 @@ func (u *UI) Event(unknown interface{}) {
break

case *apitype.ResOutputsEvent:
if evt.Metadata.Type == "pulumi:pulumi:Stack" || evt.Metadata.Type == "sst:sst:LinkRef" {
if slices.Contains(IGNORED_RESOURCES, evt.Metadata.Type) {
return
}

Expand Down Expand Up @@ -562,7 +565,7 @@ func (u *UI) FormatURN(urn string) string {
if parent == "" {
break
}
if parent.Type().DisplayName() == "pulumi:pulumi:Stack" || parent.Type().DisplayName() == "sst:sst:LinkRef" {
if slices.Contains(IGNORED_RESOURCES, parent.Type().DisplayName()) {
break
}
child = parent
Expand Down
14 changes: 10 additions & 4 deletions pkg/project/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,17 @@ func getCompletedEvent(ctx context.Context, stack auto.Stack) (*CompleteEvent, e
for _, resource := range complete.Resources {
outputs := decrypt(resource.Outputs).(map[string]interface{})
if resource.URN.Type().Module().Package().Name() == "sst" {
version, ok := outputs["_version"]
if !ok {
version = 1
if resource.Type == "sst:sst:Version" {
complete.Versions[outputs["target"].(string)] = int(outputs["version"].(float64))
}

if resource.Type != "sst:sst:Version" {
name := resource.URN.Name()
_, ok := complete.Versions[name]
if !ok {
complete.Versions[name] = 1
}
}
complete.Versions[resource.URN.Name()] = version.(int)
}
if match, ok := outputs["_live"].(map[string]interface{}); ok {
data, _ := json.Marshal(match)
Expand Down
207 changes: 106 additions & 101 deletions platform/src/components/aws/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { Dns } from "../dns";
import { FunctionArgs } from "./function";
import { Service } from "./service";
import { RETENTION } from "./logging.js";
import { cloudwatch, ecs, iam, lb } from "@pulumi/aws";
import { cloudwatch, ec2, ecs, iam, lb } from "@pulumi/aws";
import { Vpc } from "./vpc";

export const supportedCpus = {
"0.25 vCPU": 256,
Expand Down Expand Up @@ -157,7 +158,7 @@ export interface ClusterArgs {
*/
privateSubnets: Input<Input<string>[]>;
/**
* A list of VPC security group IDs.
* A list of VPC security group IDs for the service.
*/
securityGroups: Input<Input<string>[]>;
}>;
Expand Down Expand Up @@ -331,105 +332,105 @@ export interface ClusterServiceArgs {
domain?: Input<
| string
| {
/**
* The custom domain you want to use.
*
* @example
* ```js
* {
* domain: {
* name: "example.com"
* }
* }
* ```
*
* Can also include subdomains based on the current stage.
*
* ```js
* {
* domain: {
* name: `${$app.stage}.example.com`
* }
* }
* ```
*/
name: Input<string>;
/**
* The ARN of an ACM (AWS Certificate Manager) certificate that proves ownership of the
* domain. By default, a certificate is created and validated automatically.
*
* :::tip
* You need to pass in a `cert` for domains that are not hosted on supported `dns` providers.
* :::
*
* To manually set up a domain on an unsupported provider, you'll need to:
*
* 1. [Validate that you own the domain](https://docs.aws.amazon.com/acm/latest/userguide/domain-ownership-validation.html) by creating an ACM certificate. You can either validate it by setting a DNS record or by verifying an email sent to the domain owner.
* 2. Once validated, set the certificate ARN as the `cert` and set `dns` to `false`.
* 3. Add the DNS records in your provider to point to the load balancer endpoint.
*
* @example
* ```js
* {
* domain: {
* name: "example.com",
* dns: false,
* cert: "arn:aws:acm:us-east-1:112233445566:certificate/3a958790-8878-4cdc-a396-06d95064cf63"
* }
* }
* ```
*/
cert?: Input<string>;
/**
* The DNS provider to use for the domain. Defaults to the AWS.
*
* Takes an adapter that can create the DNS records on the provider. This can automate
* validating the domain and setting up the DNS routing.
*
* Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
* to set `dns` to `false` and pass in a certificate validating ownership via `cert`.
*
* @default `sst.aws.dns`
*
* @example
*
* Specify the hosted zone ID for the Route 53 domain.
*
* ```js
* {
* domain: {
* name: "example.com",
* dns: sst.aws.dns({
* zone: "Z2FDTNDATAQYW2"
* })
* }
* }
* ```
*
* Use a domain hosted on Cloudflare, needs the Cloudflare provider.
*
* ```js
* {
* domain: {
* name: "example.com",
* dns: sst.cloudflare.dns()
* }
* }
* ```
*
* Use a domain hosted on Vercel, needs the Vercel provider.
*
* ```js
* {
* domain: {
* name: "example.com",
* dns: sst.vercel.dns()
* }
* }
* ```
*/
dns?: Input<false | (Dns & {})>;
}
/**
* The custom domain you want to use.
*
* @example
* ```js
* {
* domain: {
* name: "example.com"
* }
* }
* ```
*
* Can also include subdomains based on the current stage.
*
* ```js
* {
* domain: {
* name: `${$app.stage}.example.com`
* }
* }
* ```
*/
name: Input<string>;
/**
* The ARN of an ACM (AWS Certificate Manager) certificate that proves ownership of the
* domain. By default, a certificate is created and validated automatically.
*
* :::tip
* You need to pass in a `cert` for domains that are not hosted on supported `dns` providers.
* :::
*
* To manually set up a domain on an unsupported provider, you'll need to:
*
* 1. [Validate that you own the domain](https://docs.aws.amazon.com/acm/latest/userguide/domain-ownership-validation.html) by creating an ACM certificate. You can either validate it by setting a DNS record or by verifying an email sent to the domain owner.
* 2. Once validated, set the certificate ARN as the `cert` and set `dns` to `false`.
* 3. Add the DNS records in your provider to point to the load balancer endpoint.
*
* @example
* ```js
* {
* domain: {
* name: "example.com",
* dns: false,
* cert: "arn:aws:acm:us-east-1:112233445566:certificate/3a958790-8878-4cdc-a396-06d95064cf63"
* }
* }
* ```
*/
cert?: Input<string>;
/**
* The DNS provider to use for the domain. Defaults to the AWS.
*
* Takes an adapter that can create the DNS records on the provider. This can automate
* validating the domain and setting up the DNS routing.
*
* Supports Route 53, Cloudflare, and Vercel adapters. For other providers, you'll need
* to set `dns` to `false` and pass in a certificate validating ownership via `cert`.
*
* @default `sst.aws.dns`
*
* @example
*
* Specify the hosted zone ID for the Route 53 domain.
*
* ```js
* {
* domain: {
* name: "example.com",
* dns: sst.aws.dns({
* zone: "Z2FDTNDATAQYW2"
* })
* }
* }
* ```
*
* Use a domain hosted on Cloudflare, needs the Cloudflare provider.
*
* ```js
* {
* domain: {
* name: "example.com",
* dns: sst.cloudflare.dns()
* }
* }
* ```
*
* Use a domain hosted on Vercel, needs the Vercel provider.
*
* ```js
* {
* domain: {
* name: "example.com",
* dns: sst.vercel.dns()
* }
* }
* ```
*/
dns?: Input<false | (Dns & {})>;
}
>;
/**
* Configure the mapping for the ports the public endpoint listens to and forwards to
Expand Down Expand Up @@ -747,6 +748,10 @@ export interface ClusterServiceArgs {
* Transform the AWS Load Balancer resource.
*/
loadBalancer?: Transform<lb.LoadBalancerArgs>;
/**
* Transform the AWS Security Group resource for the Load Balancer.
*/
loadBalancerSecurityGroup?: Transform<ec2.SecurityGroupArgs>;
/**
* Transform the AWS Load Balancer listener resource.
*/
Expand Down
Loading

0 comments on commit 1dfb590

Please sign in to comment.