Skip to content

fix(awstf): apply correct resource group tag filter #796

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

Merged
merged 1 commit into from
Apr 30, 2025
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
6 changes: 3 additions & 3 deletions cloud/aws/deploytf/.nitric/modules/stack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ resource "random_string" "id" {
}

resource "aws_resourcegroups_group" "group" {
name = "nitric-resource-group-${random_string.id.result}"
name = "${var.project_name}-${var.stack_name}-${random_string.id.result}"

resource_query {
query = <<JSON
{

"ResourceTypeFilters":["AWS::AllSupported"],
"TagFilters":[{"Key":"x-nitric-name-${random_string.id.result}"}]
"TagFilters":[{"Key":"x-nitric-${random_string.id.result}-name"}]
}
JSON
}
}
}
12 changes: 11 additions & 1 deletion cloud/aws/deploytf/.nitric/modules/stack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@ variable "enable_website" {
description = "Enable the creation of a website"
type = bool
default = false
}
}

variable "project_name" {
description = "The name of the project"
type = string
}

variable "stack_name" {
description = "The name of the stack"
type = string
}
5 changes: 4 additions & 1 deletion cloud/aws/deploytf/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ func (a *NitricAwsTerraformProvider) Pre(stack cdktf.TerraformStack, resources [
return item.Id.GetType() == resourcespb.ResourceType_Website
})

a.Stack = tfstack.NewStack(stack, jsii.String("stack"), &tfstack.StackConfig{})
a.Stack = tfstack.NewStack(stack, jsii.String("stack"), &tfstack.StackConfig{
StackName: jsii.String(a.StackName),
ProjectName: jsii.String(a.ProjectName),
})

databases := lo.Filter(resources, func(item *deploymentspb.Resource, idx int) bool {
return item.Id.Type == resourcespb.ResourceType_SqlDatabase
Expand Down
Binary file modified cloud/aws/deploytf/generated/api/jsii/api-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/bucket/jsii/bucket-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/cdn/jsii/cdn-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/http_proxy/jsii/http_proxy-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/keyvalue/jsii/keyvalue-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/parameter/jsii/parameter-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/policy/jsii/policy-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/queue/jsii/queue-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/rds/jsii/rds-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/schedule/jsii/schedule-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/secret/jsii/secret-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/service/jsii/service-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/sql/jsii/sql-0.0.0.tgz
Binary file not shown.
46 changes: 46 additions & 0 deletions cloud/aws/deploytf/generated/stack/Stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type Stack interface {
FriendlyUniqueId() *string
// The tree node.
Node() constructs.Node
ProjectName() *string
SetProjectName(val *string)
// Experimental.
Providers() *[]interface{}
// Experimental.
Expand All @@ -43,6 +45,8 @@ type Stack interface {
// Experimental.
Source() *string
StackIdOutput() *string
StackName() *string
SetStackName(val *string)
// Experimental.
Version() *string
// Experimental.
Expand Down Expand Up @@ -156,6 +160,16 @@ func (j *jsiiProxy_Stack) Node() constructs.Node {
return returns
}

func (j *jsiiProxy_Stack) ProjectName() *string {
var returns *string
_jsii_.Get(
j,
"projectName",
&returns,
)
return returns
}

func (j *jsiiProxy_Stack) Providers() *[]interface{} {
var returns *[]interface{}
_jsii_.Get(
Expand Down Expand Up @@ -206,6 +220,16 @@ func (j *jsiiProxy_Stack) StackIdOutput() *string {
return returns
}

func (j *jsiiProxy_Stack) StackName() *string {
var returns *string
_jsii_.Get(
j,
"stackName",
&returns,
)
return returns
}

func (j *jsiiProxy_Stack) Version() *string {
var returns *string
_jsii_.Get(
Expand Down Expand Up @@ -268,6 +292,28 @@ func (j *jsiiProxy_Stack)SetForEach(val cdktf.ITerraformIterator) {
)
}

func (j *jsiiProxy_Stack)SetProjectName(val *string) {
if err := j.validateSetProjectNameParameters(val); err != nil {
panic(err)
}
_jsii_.Set(
j,
"projectName",
val,
)
}

func (j *jsiiProxy_Stack)SetStackName(val *string) {
if err := j.validateSetStackNameParameters(val); err != nil {
panic(err)
}
_jsii_.Set(
j,
"stackName",
val,
)
}

// Checks if `x` is a construct.
//
// Use this method instead of `instanceof` to properly detect `Construct`
Expand Down
4 changes: 4 additions & 0 deletions cloud/aws/deploytf/generated/stack/StackConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ type StackConfig struct {
Providers *[]interface{} `field:"optional" json:"providers" yaml:"providers"`
// Experimental.
SkipAssetCreationFromLocalModules *bool `field:"optional" json:"skipAssetCreationFromLocalModules" yaml:"skipAssetCreationFromLocalModules"`
// The name of the project.
ProjectName *string `field:"required" json:"projectName" yaml:"projectName"`
// The name of the stack.
StackName *string `field:"required" json:"stackName" yaml:"stackName"`
// Enable the creation of a website.
EnableWebsite *bool `field:"optional" json:"enableWebsite" yaml:"enableWebsite"`
}
Expand Down
19 changes: 19 additions & 0 deletions cloud/aws/deploytf/generated/stack/Stack__checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ func validateStack_IsTerraformElementParameters(x interface{}) error {
return nil
}

func (j *jsiiProxy_Stack) validateSetProjectNameParameters(val *string) error {
if val == nil {
return fmt.Errorf("parameter val is required, but nil was provided")
}

return nil
}

func (j *jsiiProxy_Stack) validateSetStackNameParameters(val *string) error {
if val == nil {
return fmt.Errorf("parameter val is required, but nil was provided")
}

return nil
}

func validateNewStackParameters(scope constructs.Construct, id *string, config *StackConfig) error {
if scope == nil {
return fmt.Errorf("parameter scope is required, but nil was provided")
Expand All @@ -99,6 +115,9 @@ func validateNewStackParameters(scope constructs.Construct, id *string, config *
return fmt.Errorf("parameter id is required, but nil was provided")
}

if config == nil {
return fmt.Errorf("parameter config is required, but nil was provided")
}
if err := _jsii_.ValidateStruct(config, func() string { return "parameter config" }); err != nil {
return err
}
Expand Down
8 changes: 8 additions & 0 deletions cloud/aws/deploytf/generated/stack/Stack__no_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ func validateStack_IsTerraformElementParameters(x interface{}) error {
return nil
}

func (j *jsiiProxy_Stack) validateSetProjectNameParameters(val *string) error {
return nil
}

func (j *jsiiProxy_Stack) validateSetStackNameParameters(val *string) error {
return nil
}

func validateNewStackParameters(scope constructs.Construct, id *string, config *StackConfig) error {
return nil
}
Expand Down
Binary file modified cloud/aws/deploytf/generated/stack/jsii/stack-0.0.0.tgz
Binary file not shown.
2 changes: 2 additions & 0 deletions cloud/aws/deploytf/generated/stack/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ func init() {
_jsii_.MemberMethod{JsiiMethod: "interpolationForOutput", GoMethod: "InterpolationForOutput"},
_jsii_.MemberProperty{JsiiProperty: "node", GoGetter: "Node"},
_jsii_.MemberMethod{JsiiMethod: "overrideLogicalId", GoMethod: "OverrideLogicalId"},
_jsii_.MemberProperty{JsiiProperty: "projectName", GoGetter: "ProjectName"},
_jsii_.MemberProperty{JsiiProperty: "providers", GoGetter: "Providers"},
_jsii_.MemberProperty{JsiiProperty: "rawOverrides", GoGetter: "RawOverrides"},
_jsii_.MemberMethod{JsiiMethod: "resetOverrideLogicalId", GoMethod: "ResetOverrideLogicalId"},
_jsii_.MemberProperty{JsiiProperty: "skipAssetCreationFromLocalModules", GoGetter: "SkipAssetCreationFromLocalModules"},
_jsii_.MemberProperty{JsiiProperty: "source", GoGetter: "Source"},
_jsii_.MemberProperty{JsiiProperty: "stackIdOutput", GoGetter: "StackIdOutput"},
_jsii_.MemberProperty{JsiiProperty: "stackName", GoGetter: "StackName"},
_jsii_.MemberMethod{JsiiMethod: "synthesizeAttributes", GoMethod: "SynthesizeAttributes"},
_jsii_.MemberMethod{JsiiMethod: "synthesizeHclAttributes", GoMethod: "SynthesizeHclAttributes"},
_jsii_.MemberMethod{JsiiMethod: "toHclTerraform", GoMethod: "ToHclTerraform"},
Expand Down
Binary file modified cloud/aws/deploytf/generated/topic/jsii/topic-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/vpc/jsii/vpc-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/website/jsii/website-0.0.0.tgz
Binary file not shown.
Binary file modified cloud/aws/deploytf/generated/websocket/jsii/websocket-0.0.0.tgz
Binary file not shown.
Loading