Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ require (
github.com/MShekow/directory-checksum v1.4.9
github.com/anthonycorbacho/slack-webhook v1.0.1
github.com/antonmedv/expr v1.12.6
github.com/atombender/go-jsonschema v0.20.0
github.com/atombender/go-jsonschema v0.22.0
github.com/aws/aws-lambda-go v1.47.0
github.com/aws/aws-secretsmanager-caching-go v1.1.3
github.com/cloudflare/cloudflare-go v0.104.0
github.com/compose-spec/compose-go v1.20.2
github.com/disgoorg/disgo v0.18.5
github.com/docker/docker v28.5.2+incompatible
github.com/fatih/color v1.18.0
github.com/go-delve/delve v1.25.2
github.com/go-delve/delve v1.26.0
github.com/go-git/go-billy/v5 v5.6.1
github.com/go-git/go-git/v5 v5.13.1
github.com/golangci/golangci-lint v1.64.8
Expand All @@ -40,7 +40,7 @@ require (
github.com/pulumi/pulumi/sdk/v3 v3.184.0
github.com/samber/lo v1.38.1
github.com/spf13/afero v1.14.0
github.com/spf13/cobra v1.9.1
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
github.com/tmc/langchaingo v0.1.13
github.com/valyala/fasttemplate v1.2.2
Expand All @@ -56,7 +56,7 @@ require (
gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.35.0
k8s.io/client-go v0.35.0
mvdan.cc/gofumpt v0.9.1
mvdan.cc/gofumpt v0.9.2
)

require (
Expand Down Expand Up @@ -167,7 +167,7 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.5.0 // indirect
github.com/denis-tingaikin/go-header v0.5.0 // indirect
github.com/derekparker/trie v0.0.0-20230829180723-39f4de51ef7d // indirect
github.com/derekparker/trie/v3 v3.2.0 // indirect
github.com/disgoorg/json v1.1.0 // indirect
github.com/disgoorg/snowflake/v2 v2.0.1 // indirect
github.com/distribution/reference v0.5.0 // indirect
Expand Down Expand Up @@ -211,7 +211,7 @@ require (
github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/goccy/go-yaml v1.17.1 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
Expand Down Expand Up @@ -252,7 +252,6 @@ require (
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.22.0 // indirect
Expand Down Expand Up @@ -384,7 +383,7 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/viper v1.20.0 // indirect
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
Expand Down
30 changes: 14 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8ger
github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU=
github.com/ashanbrown/makezero v1.2.0 h1:/2Lp1bypdmK9wDIq7uWBlDF1iMUpIIS4A+pF6C9IEUU=
github.com/ashanbrown/makezero v1.2.0/go.mod h1:dxlPhHbDMC6N6xICzFBSK+4njQDdK8euNO0qjQMtGY4=
github.com/atombender/go-jsonschema v0.20.0 h1:AHg0LeI0HcjQ686ALwUNqVJjNRcSXpIR6U+wC2J0aFY=
github.com/atombender/go-jsonschema v0.20.0/go.mod h1:ZmbuR11v2+cMM0PdP6ySxtyZEGFBmhgF4xa4J6Hdls8=
github.com/atombender/go-jsonschema v0.22.0 h1:7H48X5fUccsfsacar5UfP6nnOXuQzmnr6lQmH/Fj2pQ=
github.com/atombender/go-jsonschema v0.22.0/go.mod h1:8Q281v0ozTIfvdnbwDoWQDIk0syH6F0Fpoq+Z1cs+rM=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aws/aws-lambda-go v1.47.0 h1:0H8s0vumYx/YKs4sE7YM0ktwL2eWse+kfopsRI1sXVI=
Expand Down Expand Up @@ -323,8 +323,8 @@ github.com/deckarep/golang-set/v2 v2.5.0 h1:hn6cEZtQ0h3J8kFrHR/NrzyOoTnjgW1+FmNJ
github.com/deckarep/golang-set/v2 v2.5.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/denis-tingaikin/go-header v0.5.0 h1:SRdnP5ZKvcO9KKRP1KJrhFR3RrlGuD+42t4429eC9k8=
github.com/denis-tingaikin/go-header v0.5.0/go.mod h1:mMenU5bWrok6Wl2UsZjy+1okegmwQ3UgWl4V1D8gjlY=
github.com/derekparker/trie v0.0.0-20230829180723-39f4de51ef7d h1:hUWoLdw5kvo2xCsqlsIBMvWUc1QCSsCYD2J2+Fg6YoU=
github.com/derekparker/trie v0.0.0-20230829180723-39f4de51ef7d/go.mod h1:C7Es+DLenIpPc9J6IYw4jrK0h7S9bKj4DNl8+KxGEXU=
github.com/derekparker/trie/v3 v3.2.0 h1:fET3Qbp9xSB7yc7tz6Y2GKMNl0SycYFo3cmiRI3Gpf0=
github.com/derekparker/trie/v3 v3.2.0/go.mod h1:P94lW0LPgiaMgKAEQD59IDZD2jMK9paKok8Nli/nQbE=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/disgoorg/disgo v0.18.5 h1:T4X9ARKJFwCon4xkw4Dg+SjGpFo7usQ7QCCX2+snGXQ=
Expand Down Expand Up @@ -393,8 +393,8 @@ github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
github.com/go-critic/go-critic v0.12.0 h1:iLosHZuye812wnkEz1Xu3aBwn5ocCPfc9yqmFG9pa6w=
github.com/go-critic/go-critic v0.12.0/go.mod h1:DpE0P6OVc6JzVYzmM5gq5jMU31zLr4am5mB/VfFK64w=
github.com/go-delve/delve v1.25.2 h1:EI6EIWGKUEC7OVE5nfG2eQSv5xEgCRxO1+REB7FKCtE=
github.com/go-delve/delve v1.25.2/go.mod h1:sBjdpmDVpQd8nIMFldtqJZkk0RpGXrf8AAp5HeRi0CM=
github.com/go-delve/delve v1.26.0 h1:YZT1kXD76mxba4/wr+tyUa/tSmy7qzoDsmxutT42PIs=
github.com/go-delve/delve v1.26.0/go.mod h1:8BgFFOXTi1y1M+d/4ax1LdFw0mlqezQiTZQpbpwgBxo=
github.com/go-delve/liner v1.2.3-0.20231231155935-4726ab1d7f62 h1:IGtvsNyIuRjl04XAOFGACozgUD7A82UffYxZt4DWbvA=
github.com/go-delve/liner v1.2.3-0.20231231155935-4726ab1d7f62/go.mod h1:biJCRbqp51wS+I92HMqn5H8/A0PAhxn2vyOT+JqhiGI=
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
Expand Down Expand Up @@ -469,8 +469,8 @@ github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.17.1 h1:LI34wktB2xEE3ONG/2Ar54+/HJVBriAGJ55PHls4YuY=
github.com/goccy/go-yaml v1.17.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
Expand Down Expand Up @@ -640,8 +640,6 @@ github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKe
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
Expand Down Expand Up @@ -1049,12 +1047,12 @@ github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.20.0 h1:zrxIyR3RQIOsarIrgL8+sAvALXul9jeEPa06Y0Ph6vY=
github.com/spf13/viper v1.20.0/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE=
Expand Down Expand Up @@ -1666,8 +1664,8 @@ k8s.io/utils v0.0.0-20251220205832-9d40a56c1308 h1:rk+D2uTO79bbNsICltOdVoA6mcJb0
k8s.io/utils v0.0.0-20251220205832-9d40a56c1308/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
lukechampine.com/frand v1.4.2 h1:RzFIpOvkMXuPMBb9maa4ND4wjBn71E1Jpf8BzJHMaVw=
lukechampine.com/frand v1.4.2/go.mod h1:4S/TM2ZgrKejMcKMbeLjISpJMO+/eZ1zu3vYX9dtj3s=
mvdan.cc/gofumpt v0.9.1 h1:p5YT2NfFWsYyTieYgwcQ8aKV3xRvFH4uuN/zB2gBbMQ=
mvdan.cc/gofumpt v0.9.1/go.mod h1:3xYtNemnKiXaTh6R4VtlqDATFwBbdXI8lJvH/4qk7mw=
mvdan.cc/gofumpt v0.9.2 h1:zsEMWL8SVKGHNztrx6uZrXdp7AX8r421Vvp23sz7ik4=
mvdan.cc/gofumpt v0.9.2/go.mod h1:iB7Hn+ai8lPvofHd9ZFGVg2GOr8sBUw1QUWjNbmIL/s=
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U=
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ=
pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw=
Expand Down
86 changes: 86 additions & 0 deletions pkg/clouds/pulumi/api/tagging.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package api

import (
sdk "github.com/pulumi/pulumi/sdk/v3/go/pulumi"

"github.com/simple-container-com/api/pkg/api"
)

// Tag keys for consistent resource identification across clouds
const (
// StackTag identifies the stack name
StackTag = "simple-container.com/stack"

// EnvironmentTag identifies the environment (e.g., production, staging)
EnvironmentTag = "simple-container.com/env"

// ParentStackTag identifies the parent stack for nested stacks
ParentStackTag = "simple-container.com/parent-stack"

// ClientStackTag identifies the client stack for nested stacks
ClientStackTag = "simple-container.com/client-stack"
)

// Tags represents a set of tags/labels that can be applied to cloud resources
type Tags struct {
StackName string
Environment string
ParentStack *string
ClientStack *string
}

// ToAWSTags converts Tags to AWS tag format
func (t *Tags) ToAWSTags() sdk.StringMap {
tags := sdk.StringMap{
StackTag: sdk.String(t.StackName),
EnvironmentTag: sdk.String(t.Environment),
}

if t.ParentStack != nil && *t.ParentStack != "" {
tags[ParentStackTag] = sdk.String(*t.ParentStack)
}

if t.ClientStack != nil && *t.ClientStack != "" {
tags[ClientStackTag] = sdk.String(*t.ClientStack)
}

return tags
}

// ToGCPLabels converts Tags to GCP label format
func (t *Tags) ToGCPLabels() map[string]string {
labels := map[string]string{
StackTag: t.StackName,
EnvironmentTag: t.Environment,
}

if t.ParentStack != nil && *t.ParentStack != "" {
labels[ParentStackTag] = *t.ParentStack
}

if t.ClientStack != nil && *t.ClientStack != "" {
labels[ClientStackTag] = *t.ClientStack
}

return labels
}

// BuildTagsFromStackParams creates Tags from StackParams
func BuildTagsFromStackParams(params api.StackParams) *Tags {
tags := &Tags{
StackName: params.StackName,
Environment: params.Environment,
}
return tags
}

// BuildTagsFromStackParamsWithParent creates Tags from StackParams with parent and client stack info
func BuildTagsFromStackParamsWithParent(params api.StackParams, parentStack, clientStack *string) *Tags {
tags := &Tags{
StackName: params.StackName,
Environment: params.Environment,
ParentStack: parentStack,
ClientStack: clientStack,
}
return tags
}
9 changes: 5 additions & 4 deletions pkg/clouds/pulumi/aws/ecs_fargate.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/simple-container-com/api/pkg/api"
"github.com/simple-container-com/api/pkg/clouds/aws"
pApi "github.com/simple-container-com/api/pkg/clouds/pulumi/api"
taggingUtil "github.com/simple-container-com/api/pkg/clouds/pulumi/api"
"github.com/simple-container-com/api/pkg/util"
)

Expand Down Expand Up @@ -129,10 +130,10 @@ func createEcsFargateCluster(ctx *sdk.Context, stack api.Stack, params pApi.Prov
sdk.Provider(params.Provider),
sdk.DependsOn(params.ComputeContext.Dependencies()),
}
tags := sdk.StringMap{
"simple-container.com/stack": sdk.String(deployParams.StackName),
"simple-container.com/env": sdk.String(deployParams.Environment),
}

// Build unified tags using the tagging utility
tags := taggingUtil.BuildTagsFromStackParams(deployParams).ToAWSTags()

for _, img := range ref.Images {
opts = append(opts, img.AddOpts...)
}
Expand Down
12 changes: 9 additions & 3 deletions pkg/clouds/pulumi/aws/kms_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/simple-container-com/api/pkg/api"
"github.com/simple-container-com/api/pkg/clouds/aws"
pApi "github.com/simple-container-com/api/pkg/clouds/pulumi/api"
taggingUtil "github.com/simple-container-com/api/pkg/clouds/pulumi/api"
)

func KmsKeySecretsProvider(ctx *sdk.Context, stack api.Stack, input api.ResourceInput, params pApi.ProvisionParams) (*api.ResourceOutput, error) {
Expand All @@ -24,11 +25,16 @@ func KmsKeySecretsProvider(ctx *sdk.Context, stack api.Stack, input api.Resource
return nil, errors.Wrapf(err, "failed to convert auth config to aws.AccountConfig")
}

// Build unified tags using the tagging utility
var stackParams api.StackParams
if input.StackParams != nil {
stackParams = *input.StackParams
}
tags := taggingUtil.BuildTagsFromStackParams(stackParams).ToAWSTags()

// Create a new KMS Key for encryption/decryption operations
key, err := kms.NewKey(ctx, input.Descriptor.Name, &kms.KeyArgs{
Tags: sdk.StringMap{
"stack": sdk.String(stack.Name),
},
Tags: tags,
EnableKeyRotation: sdk.Bool(true),
}, sdk.Provider(params.Provider))
if err != nil {
Expand Down
30 changes: 24 additions & 6 deletions pkg/clouds/pulumi/aws/static_egress.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
sdk "github.com/pulumi/pulumi/sdk/v3/go/pulumi"

"github.com/simple-container-com/api/pkg/api"
"github.com/simple-container-com/api/pkg/clouds/aws"
pApi "github.com/simple-container-com/api/pkg/clouds/pulumi/api"
taggingUtil "github.com/simple-container-com/api/pkg/clouds/pulumi/api"
"github.com/simple-container-com/api/pkg/util"
)

Expand Down Expand Up @@ -68,13 +70,23 @@ type StaticEgressIPIn struct {
Provider sdk.ProviderResource
AccountConfig aws.AccountConfig
SecurityGroup *aws.SecurityGroup
StackParams api.StackParams
}

func provisionStaticEgressForMultiZoneVpc(ctx *sdk.Context, resName string, input *StaticEgressIPIn, opts ...sdk.ResourceOption) (*MultiStaticEgressIPOut, error) {
params := input.Params
tags := sdk.StringMap{

// Build unified tags using the tagging utility
scTags := taggingUtil.BuildTagsFromStackParams(input.StackParams).ToAWSTags()

// Add resource-specific tags
baseTags := sdk.StringMap{
"resource": sdk.String(resName),
}
// Merge SC tags with resource-specific tags
for k, v := range scTags {
baseTags[k] = v
}

params.Log.Info(ctx.Context(), "configure public subnet for %s...", resName)

Expand All @@ -91,7 +103,7 @@ func provisionStaticEgressForMultiZoneVpc(ctx *sdk.Context, resName string, inpu
params.Log.Info(ctx.Context(), "configure VPC for %s...", resName)
vpc, err := ec2.NewVpc(ctx, vpcName, &ec2.VpcArgs{
CidrBlock: sdk.String("172.31.0.0/16"),
Tags: tags,
Tags: baseTags,
}, opts...)
if err != nil {
return nil, errors.Wrapf(err, "failed to create vpc for %q", resName)
Expand All @@ -101,7 +113,7 @@ func provisionStaticEgressForMultiZoneVpc(ctx *sdk.Context, resName string, inpu
igwName := fmt.Sprintf("%s-igw", resName)
igw, err := ec2.NewInternetGateway(ctx, igwName, &ec2.InternetGatewayArgs{
VpcId: vpc.ID(),
Tags: tags,
Tags: baseTags,
}, opts...)
if err != nil {
return nil, errors.Wrapf(err, "failed to provision internet gateway for %q", resName)
Expand All @@ -112,7 +124,7 @@ func provisionStaticEgressForMultiZoneVpc(ctx *sdk.Context, resName string, inpu
publicRouteTableName := fmt.Sprintf("%s-public-route-table", resName)
publicRouteTable, err := ec2.NewRouteTable(ctx, publicRouteTableName, &ec2.RouteTableArgs{
VpcId: vpc.ID(),
Tags: tags,
Tags: baseTags,
Routes: ec2.RouteTableRouteArray{
&ec2.RouteTableRouteArgs{
CidrBlock: sdk.String("0.0.0.0/0"),
Expand Down Expand Up @@ -140,10 +152,16 @@ func provisionStaticEgressForMultiZoneVpc(ctx *sdk.Context, resName string, inpu
pubSubnetName := fmt.Sprintf("%s-public-subnet-%s", resName, zoneName)
publicCidrBlock := fmt.Sprintf("172.31.%d.0/24", index+1)
privateCidrBlock := fmt.Sprintf("172.31.%d.0/24", index+1+len(zones.Names))
zonedTags := map[string]string{

// Build zoned tags with SC metadata
zonedTags := lo.Assign(map[string]string{
"zone": zoneName,
"resource": resName,
}
}, map[string]string{
string(taggingUtil.StackTag): input.StackParams.StackName,
string(taggingUtil.EnvironmentTag): input.StackParams.Environment,
})

publicSubnet, err := ec2.NewSubnet(ctx, pubSubnetName, &ec2.SubnetArgs{
VpcId: vpc.ID(),
CidrBlock: sdk.String(publicCidrBlock),
Expand Down
9 changes: 9 additions & 0 deletions pkg/clouds/pulumi/gcp/artifactregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/simple-container-com/api/pkg/api"
"github.com/simple-container-com/api/pkg/clouds/gcloud"
pApi "github.com/simple-container-com/api/pkg/clouds/pulumi/api"
taggingUtil "github.com/simple-container-com/api/pkg/clouds/pulumi/api"
"github.com/simple-container-com/api/pkg/util"
)

Expand Down Expand Up @@ -52,11 +53,19 @@ func ArtifactRegistry(ctx *sdk.Context, stack api.Stack, input api.ResourceInput

out := &ArtifactRegistryOut{}

// Build unified labels using the tagging utility
var stackParams api.StackParams
if input.StackParams != nil {
stackParams = *input.StackParams
}
labels := taggingUtil.BuildTagsFromStackParams(stackParams).ToGCPLabels()

// Create a new Artifact Registry repository for Docker images
repoArgs := artifactregistry.RepositoryArgs{
RepositoryId: sdk.String(artifactRegistryName),
Location: sdk.String(location),
Project: sdk.StringPtr(arCfg.ProjectId),
Labels: sdk.ToStringMap(labels),
}
if arCfg.Docker != nil {
repoArgs.Format = sdk.String("DOCKER")
Expand Down
Loading