forked from hashicorp/terraform-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
43 lines (33 loc) · 1.15 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
eks "github.com/hashicorp/terraform-cdk/examples/go/aws/generated/aws_eks_module"
"github.com/hashicorp/terraform-cdk/examples/go/aws/generated/hashicorp/aws"
"github.com/aws/constructs-go/constructs/v3"
"github.com/aws/jsii-runtime-go"
"github.com/hashicorp/terraform-cdk-go/cdktf"
)
func NewExampleCdktfGoAwsStack(scope constructs.Construct, id string) cdktf.TerraformStack {
stack := cdktf.NewTerraformStack(scope, &id)
aws.NewAwsProvider(stack, jsii.String("aws"), &aws.AwsProviderConfig{
Region: jsii.String("us-east-1"),
})
aws.NewInstance(stack, jsii.String("Hello"), &aws.InstanceConfig{
Ami: jsii.String("ami-2757f631"),
InstanceType: jsii.String("t2.micro"),
Tags: &map[string]*string{
"environment": jsii.String("development"),
},
})
eks.NewAwsEksModule(stack, jsii.String("EKS"), &eks.AwsEksModuleOptions{
ClusterName: jsii.String("my-eks"),
Subnets: jsii.Strings("a", "b"),
VpcId: jsii.String("id"),
ClusterVersion: jsii.String("1.17"),
})
return stack
}
func main() {
app := cdktf.NewApp(nil)
NewExampleCdktfGoAwsStack(app, "ExampleCdktfGoAwsStack")
app.Synth()
}