diff --git a/infra/cdk/.gitignore b/infra/cdk/.gitignore new file mode 100644 index 00000000..4033944b --- /dev/null +++ b/infra/cdk/.gitignore @@ -0,0 +1,21 @@ + +# cdktf and terraform ignores +.terraform +cdktf.out +cdktf.log +*terraform.*.tfstate* +generated + +# src https://github.com/github/gitignore/blob/master/Go.gitignore +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out diff --git a/infra/cdk/cdktf.json b/infra/cdk/cdktf.json new file mode 100644 index 00000000..20310f77 --- /dev/null +++ b/infra/cdk/cdktf.json @@ -0,0 +1,11 @@ +{ + "language": "go", + "app": "go run main.go", + "codeMakerOutput": "generated", + "terraformProviders": [], + "terraformModules": [], + "context": { + "excludeStackIdFromLogicalIds": "true", +"allowSepCharsInLogicalIds": "true" + } +} \ No newline at end of file diff --git a/infra/cdk/go.mod b/infra/cdk/go.mod new file mode 100644 index 00000000..f9d81a65 --- /dev/null +++ b/infra/cdk/go.mod @@ -0,0 +1,7 @@ +module cdk.tf/go/stack + +go 1.16 + +require github.com/aws/constructs-go/constructs/v3 v3.3.75 + +require github.com/hashicorp/terraform-cdk-go/cdktf v0.5.0 diff --git a/infra/cdk/go.sum b/infra/cdk/go.sum new file mode 100644 index 00000000..875f1d6b --- /dev/null +++ b/infra/cdk/go.sum @@ -0,0 +1,15 @@ +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/aws/constructs-go/constructs/v3 v3.3.75 h1:sunQ8/mQwVoV0OdGYmSh/s8Z2XyUXr8hCc/bKzz6SoU= +github.com/aws/constructs-go/constructs/v3 v3.3.75/go.mod h1:gh+X5UyxGPp/fWyp8iVMa75yMDQev4639pQ93HXXMoA= +github.com/aws/jsii-runtime-go v1.28.0/go.mod h1:6tZnlstx8bAB3vnLFF9n8bbkI//LDblAek9zFyMXV3E= +github.com/aws/jsii-runtime-go v1.29.0 h1:JH4GHSauYskfzREWaQMAMTXDRgNR2e5XeLbjD/xf9J0= +github.com/aws/jsii-runtime-go v1.29.0/go.mod h1:6tZnlstx8bAB3vnLFF9n8bbkI//LDblAek9zFyMXV3E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/hashicorp/terraform-cdk-go/cdktf v0.5.0 h1:zTy/YB8Q69QmiTAeVtG79TKKaFyJZF8ez7dvneRQ/LQ= +github.com/hashicorp/terraform-cdk-go/cdktf v0.5.0/go.mod h1:Lzi9rFr53rGiJGwD1OW6VjadHDApWJ94GXfdHDX3Mf4= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/infra/cdk/help b/infra/cdk/help new file mode 100644 index 00000000..8640d244 --- /dev/null +++ b/infra/cdk/help @@ -0,0 +1,24 @@ +======================================================================================================== + + Your cdktf go project is ready! + + cat help Prints this message + + Compile: + go build Builds your go project + + Synthesize: + cdktf synth [stack] Synthesize Terraform resources to cdktf.out/ + + Diff: + cdktf diff [stack] Perform a diff (terraform plan) for the given stack + + Deploy: + cdktf deploy [stack] Deploy the given stack + + Destroy: + cdktf destroy [stack] Destroy the given stack + + Learn more about using modules and providers https://cdk.tf/modules-and-providers + +======================================================================================================== \ No newline at end of file diff --git a/infra/cdk/main.go b/infra/cdk/main.go new file mode 100644 index 00000000..573fb8d2 --- /dev/null +++ b/infra/cdk/main.go @@ -0,0 +1,22 @@ +package main + +import ( + "github.com/aws/constructs-go/constructs/v3" + "github.com/hashicorp/terraform-cdk-go/cdktf" +) + +func NewMyStack(scope constructs.Construct, id string) cdktf.TerraformStack { + stack := cdktf.NewTerraformStack(scope, &id) + + // The code that defines your stack goes here + + return stack +} + +func main() { + app := cdktf.NewApp(nil) + + NewMyStack(app, "cdk") + + app.Synth() +}