Skip to content

Commit

Permalink
output updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tjholm committed Dec 13, 2024
1 parent 6b81497 commit 2445af1
Show file tree
Hide file tree
Showing 22 changed files with 101 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cloud/aws/deploytf/.nitric/modules/stack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource "aws_resourcegroups_group" "group" {
{
"ResourceTypeFilters":["AWS::AllSupported"],
"TagFilters":[{"Key":"x-nitric-name-${random_string.id.result}"}]
"TagFilters":[{"Key":"x-nitric-${random_string.id.result}-name"}]
}
JSON
}
Expand Down
5 changes: 5 additions & 0 deletions cloud/aws/deploytf/.nitric/modules/stack/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ output "stack_id" {
description = "The randomized Id of the nitric stack"
value = random_string.id.result
}

output "resource_group_arn" {
description = "The resource group for the stack"
value = aws_resourcegroups_group.group.arn
}
77 changes: 77 additions & 0 deletions cloud/aws/deploytf/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,83 @@ func (a *NitricAwsTerraformProvider) Pre(stack cdktf.TerraformStack, resources [
}

func (a *NitricAwsTerraformProvider) Post(stack cdktf.TerraformStack) error {
// Get a link to this stacks resource group in the AWS console
// outputs = append(outputs, pulumi.Sprintf("Deployed Resources:\n──────────────"))
// outputs = append(outputs, pulumi.Sprintf(, a.Region, urlEncodedRgArn))

// urlEncodedRgArn := a.ResourceGroup.Arn.ApplyT(func(arn string) string {
// // URL encode the ARN
// return url.QueryEscape(arn)
// })

cdktf.NewTerraformOutput(stack, jsii.Sprintf("deployed-resources"), &cdktf.TerraformOutputConfig{
Value: jsii.Sprintf("https://%s.console.aws.amazon.com/resource-groups/group/%s\n", a.Region, *cdktf.Fn_Urlencode(a.Stack.ResourceGroupArnOutput())),
})

// Set terraform outputs
cdktf.NewTerraformOutput(stack, jsii.Sprintf("stack-output"), &cdktf.TerraformOutputConfig{
Value: a.Stack,
})

// loop over all the resources and create outputs for them
allEndpoints := map[string]*string{}

for name, api := range a.Apis {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-api-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: api,
})
allEndpoints[name] = api.EndpointOutput()
}

if len(allEndpoints) > 0 {
cdktf.NewTerraformOutput(stack, jsii.String("endpoints"), &cdktf.TerraformOutputConfig{
Value: allEndpoints,
})
}

for name, bucket := range a.Buckets {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-bucket-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: bucket,
})
}

for name, topic := range a.Topics {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-topic-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: topic,
})
}

for name, schedule := range a.Schedules {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-schedule-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: schedule,
})
}

for name, service := range a.Services {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-service-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: service,
})
}

for name, secret := range a.Secrets {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-secret-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: secret,
})
}

for name, queue := range a.Queues {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-queue-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: queue,
})
}

return a.resourcesStore(stack)
}

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/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.
11 changes: 11 additions & 0 deletions cloud/aws/deploytf/generated/stack/Stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Stack interface {
Providers() *[]interface{}
// Experimental.
RawOverrides() interface{}
ResourceGroupArnOutput() *string
// Experimental.
SkipAssetCreationFromLocalModules() *bool
// Experimental.
Expand Down Expand Up @@ -164,6 +165,16 @@ func (j *jsiiProxy_Stack) RawOverrides() interface{} {
return returns
}

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

func (j *jsiiProxy_Stack) SkipAssetCreationFromLocalModules() *bool {
var returns *bool
_jsii_.Get(
Expand Down
Binary file modified cloud/aws/deploytf/generated/stack/jsii/stack-0.0.0.tgz
Binary file not shown.
1 change: 1 addition & 0 deletions cloud/aws/deploytf/generated/stack/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func init() {
_jsii_.MemberProperty{JsiiProperty: "providers", GoGetter: "Providers"},
_jsii_.MemberProperty{JsiiProperty: "rawOverrides", GoGetter: "RawOverrides"},
_jsii_.MemberMethod{JsiiMethod: "resetOverrideLogicalId", GoMethod: "ResetOverrideLogicalId"},
_jsii_.MemberProperty{JsiiProperty: "resourceGroupArnOutput", GoGetter: "ResourceGroupArnOutput"},
_jsii_.MemberProperty{JsiiProperty: "skipAssetCreationFromLocalModules", GoGetter: "SkipAssetCreationFromLocalModules"},
_jsii_.MemberProperty{JsiiProperty: "source", GoGetter: "Source"},
_jsii_.MemberProperty{JsiiProperty: "stackIdOutput", GoGetter: "StackIdOutput"},
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/websocket/jsii/websocket-0.0.0.tgz
Binary file not shown.
12 changes: 6 additions & 6 deletions cloud/gcp/deploytf/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,42 +231,42 @@ func (a *NitricGcpTerraformProvider) Post(stack cdktf.TerraformStack) error {
}

for name, bucket := range a.Buckets {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-api-output", name), &cdktf.TerraformOutputConfig{
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-bucket-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: bucket,
})
}

for name, topic := range a.Topics {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-api-output", name), &cdktf.TerraformOutputConfig{
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-topic-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: topic,
})
}

for name, schedule := range a.Schedules {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-api-output", name), &cdktf.TerraformOutputConfig{
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-schedule-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: schedule,
})
}

for name, service := range a.Services {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-api-output", name), &cdktf.TerraformOutputConfig{
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-service-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: service,
})
}

for name, secret := range a.Secrets {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-api-output", name), &cdktf.TerraformOutputConfig{
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-secret-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: secret,
})
}

for name, queue := range a.Queues {
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-api-output", name), &cdktf.TerraformOutputConfig{
cdktf.NewTerraformOutput(stack, jsii.Sprintf("%s-queue-output", name), &cdktf.TerraformOutputConfig{
Sensitive: jsii.Bool(true),
Value: queue,
})
Expand Down

0 comments on commit 2445af1

Please sign in to comment.