Skip to content
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

feat(provider-generator): namespace every resource / data source / provider #2087

Merged
merged 39 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
10d6710
refactor: remove file from method names
DanielMSchmidt Sep 5, 2022
39bab9b
feat(provider-generator): namespace every resource / data source / pr…
DanielMSchmidt Sep 5, 2022
412211a
chore: use namespaces
DanielMSchmidt Sep 5, 2022
ab08522
chore: adjust java example
DanielMSchmidt Sep 12, 2022
c65c3e4
chore: adjust examples
DanielMSchmidt Sep 12, 2022
55e6339
chore: adjust examples
DanielMSchmidt Sep 12, 2022
7910d0b
chore: adjust examples
DanielMSchmidt Sep 13, 2022
e142ecc
chore: adjust examples
DanielMSchmidt Sep 13, 2022
a7ade3e
feat(provider-generator): use resource-level namespaces for the previ…
DanielMSchmidt Sep 22, 2022
f1b3020
feat(provider-generator): put provider into file & namespace without …
DanielMSchmidt Sep 22, 2022
58afa1e
chore: adjust examples
DanielMSchmidt Sep 22, 2022
8c0518c
chore: update snapshots
DanielMSchmidt Sep 22, 2022
0b919a3
chore: update examples
DanielMSchmidt Sep 22, 2022
8429036
feat(hcl2cdk): handle namespacing
DanielMSchmidt Sep 22, 2022
ae86a51
chore: bring tests up to date
DanielMSchmidt Sep 22, 2022
d82879f
chore: align renaming of null provider extra case
DanielMSchmidt Sep 23, 2022
583598c
chore: bring ts tests up to date
DanielMSchmidt Sep 23, 2022
8221b8f
chore: bring python tests up to date
DanielMSchmidt Sep 23, 2022
493e087
chore: bring go tests up to date
DanielMSchmidt Sep 23, 2022
8e42fb5
chore: bring c# and java tests up to date
DanielMSchmidt Sep 23, 2022
67b752c
chore: update provider tests
DanielMSchmidt Sep 23, 2022
506727c
chore: update examples
DanielMSchmidt Sep 23, 2022
0964119
chore: fix comment
DanielMSchmidt Sep 23, 2022
3d49988
chore: fix comment
DanielMSchmidt Sep 23, 2022
9dc8f1f
fix(tests): Fix C# edge provider test
ansgarm Sep 28, 2022
d816b72
fix(tests): Fix C# testing matchers test
ansgarm Sep 28, 2022
946e5a1
fix(tests): Fix Python testing matchers test
ansgarm Sep 28, 2022
bd43a50
fix(tests): Fix Java testing matchers test
ansgarm Sep 28, 2022
6ae757d
fix(tests): Fix Go testing matchers test
ansgarm Sep 28, 2022
193a2f9
fix(tests): Fix Go synth-app test
ansgarm Sep 28, 2022
550b0fb
fix(examples): Fix C# aws example
ansgarm Sep 28, 2022
caf1a4e
fix(provider-generator): change Function resource class to FunctionRe…
ansgarm Sep 28, 2022
3b7615e
fix(examples): Fix Java aws example
ansgarm Sep 28, 2022
b88abc7
fix(tests): Fix Go testing matchers test #2
ansgarm Sep 29, 2022
9d49eb5
fix(examples): Fix Java documentation example
ansgarm Sep 29, 2022
fb8dc89
fix(examples): Fix Java gradle-shared-module example
ansgarm Sep 29, 2022
807705d
fix(examples): Fix Python aws example
ansgarm Sep 29, 2022
550d0cc
fix(examples): Fix Python documentation example
ansgarm Sep 29, 2022
dfe2a5c
chore: add comment to code
ansgarm Sep 29, 2022
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
8 changes: 4 additions & 4 deletions examples/csharp/aws/Main.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using aws;
using aws.Datasources;
using aws.Dynamodb;
using aws.Sns;
using aws.Provider;
using aws.DataAwsRegion;
using aws.DynamodbTable;
using aws.SnsTopic;
using Constructs;
using HashiCorp.Cdktf;

Expand Down
3 changes: 2 additions & 1 deletion examples/csharp/azure/Main.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using azurerm;
using azurerm.Provider;
using azurerm.VirtualNetwork;
using Constructs;
using HashiCorp.Cdktf;

Expand Down
7 changes: 4 additions & 3 deletions examples/csharp/documentation/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
using HashiCorp.Cdktf;
// DOCS_BLOCK_END:assets,constructs
// DOCS_BLOCK_START:assets
using aws;
using aws.S3;
using aws.Provider;
using aws.S3Bucket;
using aws.S3BucketObject;
// DOCS_BLOCK_END:assets
// DOCS_BLOCK_START:constructs
using kubernetes;
using kubernetes.Provider;
using MyConstructs;
// DOCS_BLOCK_END:constructs

Expand Down
4 changes: 3 additions & 1 deletion examples/csharp/google/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using google;
using google.Provider;
using google.ComputeNetwork;
using google.ComputeInstance;
using Constructs;
using HashiCorp.Cdktf;

Expand Down
4 changes: 3 additions & 1 deletion examples/csharp/ucloud/Main.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ucloud;
using ucloud.Provider;
using ucloud.DataUcloudImages;
using ucloud.Instance;
using Constructs;
using HashiCorp.Cdktf;

Expand Down
4 changes: 2 additions & 2 deletions examples/go/aws/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"github.com/hashicorp/terraform-cdk/examples/go/aws/generated/eks"
"github.com/hashicorp/terraform-cdk/examples/go/aws/generated/hashicorp/aws"
"github.com/hashicorp/terraform-cdk/examples/go/aws/generated/hashicorp/aws/awsprovider"
"github.com/hashicorp/terraform-cdk/examples/go/aws/generated/hashicorp/aws/ec2"

"github.com/aws/constructs-go/constructs/v10"
Expand All @@ -13,7 +13,7 @@ import (
func NewExampleCdktfGoAwsStack(scope constructs.Construct, id string) cdktf.TerraformStack {
stack := cdktf.NewTerraformStack(scope, &id)

aws.NewAwsProvider(stack, jsii.String("aws"), &aws.AwsProviderConfig{
awsprovider.NewAwsProvider(stack, jsii.String("aws"), &awsprovider.AwsProviderConfig{
Region: jsii.String("us-east-1"),
})

Expand Down
3 changes: 0 additions & 3 deletions examples/go/azure/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ module github.com/hashicorp/terraform-cdk/examples/go/azure

go 1.16



require (
github.com/aws/constructs-go/constructs/v10 v10.1.90
github.com/aws/jsii-runtime-go v1.67.0
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/terraform-cdk-go/cdktf v0.0.0
)

Expand Down
42 changes: 41 additions & 1 deletion examples/go/azure/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,58 @@ github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030I
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/aws/constructs-go/constructs/v10 v10.1.90 h1:qnkud+2Jdzxh2g3cjSqImqyDp2pobEVWDesyw0uNnCc=
github.com/aws/constructs-go/constructs/v10 v10.1.90/go.mod h1:7+5GjvX5buJY6vZZmMxd50Ke1+NXzjva8N2eL+3txQQ=
github.com/aws/jsii-runtime-go v1.65.0 h1:A6o9DpZD0+IeFrXJ/qBPX7VJne5Vuk2KSfrG5Ez2dz8=
github.com/aws/jsii-runtime-go v1.65.0/go.mod h1:Dq2QkYFSpiHGabsCBMmLnnGkyx3lnf5k6C6fq8RN/90=
github.com/aws/jsii-runtime-go v1.67.0 h1:kE3XxCLesjvdmSlnG0P/61+eTz2w1vnBTp/ZLkcAY48=
github.com/aws/jsii-runtime-go v1.67.0/go.mod h1:91SPsitQ+dDlxHNkXqVt1C6QmPmHC32QJm4xg6F5Q+4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
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/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
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=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
29 changes: 17 additions & 12 deletions examples/go/azure/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ import (
"github.com/aws/jsii-runtime-go"
"github.com/hashicorp/terraform-cdk-go/cdktf"

"github.com/hashicorp/terraform-cdk/examples/go/azure/generated/hashicorp/azurerm"
"github.com/hashicorp/terraform-cdk/examples/go/azure/generated/hashicorp/azurerm/azurermprovider"
"github.com/hashicorp/terraform-cdk/examples/go/azure/generated/hashicorp/azurerm/linuxvirtualmachine"
"github.com/hashicorp/terraform-cdk/examples/go/azure/generated/hashicorp/azurerm/networkinterface"
"github.com/hashicorp/terraform-cdk/examples/go/azure/generated/hashicorp/azurerm/resourcegroup"
"github.com/hashicorp/terraform-cdk/examples/go/azure/generated/hashicorp/azurerm/subnet"
"github.com/hashicorp/terraform-cdk/examples/go/azure/generated/hashicorp/azurerm/virtualnetwork"
"github.com/hashicorp/terraform-cdk/examples/go/azure/generated/nullmodule"
)

func NewMyStack(scope constructs.Construct, id string) cdktf.TerraformStack {
stack := cdktf.NewTerraformStack(scope, &id)

//Initialise the provider
azurerm.NewAzurermProvider(stack, jsii.String("azurerm"), &azurerm.AzurermProviderConfig{
Features: &azurerm.AzurermProviderFeatures{},
azurermprovider.NewAzurermProvider(stack, jsii.String("azurerm"), &azurermprovider.AzurermProviderConfig{
Features: &azurermprovider.AzurermProviderFeatures{},
//Subscription: jsii.String(""), //Just for an example, login credential is coming from ARM* environment variables
})

Expand All @@ -32,59 +37,59 @@ func NewMyStack(scope constructs.Construct, id string) cdktf.TerraformStack {
*/

//Create a resource group
rg := azurerm.NewResourceGroup(stack, jsii.String("test_rg"), &azurerm.ResourceGroupConfig{
rg := resourcegroup.NewResourceGroup(stack, jsii.String("test_rg"), &resourcegroup.ResourceGroupConfig{
//Name: n.ResourceGroupOutput(), //GOTO 26
Name: jsii.String("test-rg"),
Location: jsii.String("westeurope"),
})

//Create the azurerm Virtual Network with a subnet
vm_nw := azurerm.NewVirtualNetwork(stack, jsii.String("test_vm_nw"), &azurerm.VirtualNetworkConfig{
vm_nw := virtualnetwork.NewVirtualNetwork(stack, jsii.String("test_vm_nw"), &virtualnetwork.VirtualNetworkConfig{
Name: jsii.String("test-vm-nw"),
AddressSpace: &[]*string{jsii.String("10.0.0.0/16")},
Location: rg.Location(),
ResourceGroupName: rg.Name(),
})

vm_nw_sn := azurerm.NewSubnet(stack, jsii.String("test_vm_nw_sn"), &azurerm.SubnetConfig{
vm_nw_sn := subnet.NewSubnet(stack, jsii.String("test_vm_nw_sn"), &subnet.SubnetConfig{
Name: jsii.String("test-vm-nw-sn"),
ResourceGroupName: rg.Name(),
VirtualNetworkName: vm_nw.Name(),
AddressPrefixes: &[]*string{jsii.String("10.0.2.0/24")},
})

//Create the test Virtual Machine with its Network Interface
vm_nic := azurerm.NewNetworkInterface(stack, jsii.String("test_vm_nic"), &azurerm.NetworkInterfaceConfig{
vm_nic := networkinterface.NewNetworkInterface(stack, jsii.String("test_vm_nic"), &networkinterface.NetworkInterfaceConfig{
Name: jsii.String("test-vm-nic"),
Location: rg.Location(),
ResourceGroupName: rg.Name(),

IpConfiguration: &[]*azurerm.NetworkInterfaceIpConfiguration{{
IpConfiguration: &[]*networkinterface.NetworkInterfaceIpConfiguration{{
Name: jsii.String("internal"),
SubnetId: vm_nw_sn.Id(),
PrivateIpAddressAllocation: jsii.String("Dynamic"),
}},
})

vm := azurerm.NewLinuxVirtualMachine(stack, jsii.String("test_vm"), &azurerm.LinuxVirtualMachineConfig{
vm := linuxvirtualmachine.NewLinuxVirtualMachine(stack, jsii.String("test_vm"), &linuxvirtualmachine.LinuxVirtualMachineConfig{
Name: jsii.String("test-vm"),
Location: rg.Location(),
ResourceGroupName: rg.Name(),
Size: jsii.String("Standard_F2"),
AdminUsername: jsii.String("adminuser"),
NetworkInterfaceIds: &[]*string{vm_nic.Id()},

AdminSshKey: &[]*azurerm.LinuxVirtualMachineAdminSshKey{{
AdminSshKey: &[]*linuxvirtualmachine.LinuxVirtualMachineAdminSshKey{{
Username: jsii.String("glados"),
PublicKey: cdktf.Fn_File(jsii.String("~/.ssh/id_rsa.pub")),
}},

OsDisk: &azurerm.LinuxVirtualMachineOsDisk{
OsDisk: &linuxvirtualmachine.LinuxVirtualMachineOsDisk{
Caching: jsii.String("ReadWrite"),
StorageAccountType: jsii.String("Standard_LRS"),
},

SourceImageReference: &azurerm.LinuxVirtualMachineSourceImageReference{
SourceImageReference: &linuxvirtualmachine.LinuxVirtualMachineSourceImageReference{
Publisher: jsii.String("Canonical"),
Offer: jsii.String("UbuntuServer"),
Sku: jsii.String("16.04-LTS"),
Expand Down
12 changes: 7 additions & 5 deletions examples/go/docker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ Steps:
package main

import (
"github.com/hashicorp/terraform-cdk/examples/go/docker/generated/kreuzwerker/docker"
"github.com/hashicorp/terraform-cdk/examples/go/docker/generated/kreuzwerker/docker/container"
"github.com/hashicorp/terraform-cdk/examples/go/docker/generated/kreuzwerker/docker/image"
dockerprovider "github.com/hashicorp/terraform-cdk/examples/go/docker/generated/kreuzwerker/docker/provider"

"github.com/aws/constructs-go/constructs/v10"
"github.com/aws/jsii-runtime-go"
Expand All @@ -27,17 +29,17 @@ import (
func NewExampleCdktfGoDockerStack(scope constructs.Construct, id string) cdktf.TerraformStack {
stack := cdktf.NewTerraformStack(scope, &id)

docker.NewDockerProvider(stack, jsii.String("provider"), &docker.DockerProviderConfig{})
dockerprovider.NewDockerProvider(stack, jsii.String("provider"), &dockerprovider.DockerProviderConfig{})

dockerImage := docker.NewImage(stack, jsii.String("nginxImage"), &docker.ImageConfig{
dockerImage := image.NewImage(stack, jsii.String("nginxImage"), &image.ImageConfig{
Name: jsii.String("nginx:latest"),
KeepLocally: jsii.Bool(false),
})

docker.NewContainer(stack, jsii.String("nginxContainer"), &docker.ContainerConfig{
container.NewContainer(stack, jsii.String("nginxContainer"), &container.ContainerConfig{
Image: dockerImage.Latest(),
Name: jsii.String("tutorial"),
Ports: &[]*docker.ContainerPorts{{
Ports: &[]*container.ContainerPorts{{
Internal: jsii.Number(80), External: jsii.Number(8000),
}},
})
Expand Down
10 changes: 6 additions & 4 deletions examples/go/scaleway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package main
import (
"os"

"cdk.tf/go/stack/generated/scaleway/scaleway"
"cdk.tf/go/stack/generated/scaleway/scaleway/instanceip"
"cdk.tf/go/stack/generated/scaleway/scaleway/instanceserver"
"cdk.tf/go/stack/generated/scaleway/scaleway/provider"
"github.com/aws/constructs-go/constructs/v10"
"github.com/aws/jsii-runtime-go"
"github.com/hashicorp/terraform-cdk-go/cdktf"
Expand All @@ -12,15 +14,15 @@ import (
func NewMyStack(scope constructs.Construct, id string) cdktf.TerraformStack {
stack := cdktf.NewTerraformStack(scope, &id)

scaleway.NewScalewayProvider(stack, jsii.String("scaleway"), &scaleway.ScalewayProviderConfig{
provider.NewScalewayProvider(stack, jsii.String("scaleway"), &provider.ScalewayProviderConfig{
Region: jsii.String("fr-par"),
Zone: jsii.String("fr-par-1"),
ProjectId: jsii.String(os.Getenv("SCW_DEFAULT_PROJECT_ID")),
})

reservedIp := scaleway.NewInstanceIp(stack, jsii.String("cdk-demo-ip"), &scaleway.InstanceIpConfig{})
reservedIp := instanceip.NewInstanceIp(stack, jsii.String("cdk-demo-ip"), &instanceip.InstanceIpConfig{})

scaleway.NewInstanceServer(stack, jsii.String("cdk-demo-server"), &scaleway.InstanceServerConfig{
instanceserver.NewInstanceServer(stack, jsii.String("cdk-demo-server"), &instanceserver.InstanceServerConfig{
Image: jsii.String("ubuntu_focal"),
Type: jsii.String("DEV1-S"),
IpId: reservedIp.Id(),
Expand Down
10 changes: 6 additions & 4 deletions examples/go/ucloud/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ import (
"github.com/aws/constructs-go/constructs/v10"
"github.com/aws/jsii-runtime-go"
"github.com/hashicorp/terraform-cdk-go/cdktf"
"github.com/hashicorp/terraform-cdk/examples/go/ucloud/generated/ucloud/ucloud"
"github.com/hashicorp/terraform-cdk/examples/go/ucloud/generated/ucloud/ucloud/dataucloudimages"
"github.com/hashicorp/terraform-cdk/examples/go/ucloud/generated/ucloud/ucloud/instance"
ucloudprovider "github.com/hashicorp/terraform-cdk/examples/go/ucloud/generated/ucloud/ucloud/provider"
)

func NewMyStack(scope constructs.Construct, id string) cdktf.TerraformStack {
stack := cdktf.NewTerraformStack(scope, &id)

ucloud.NewUcloudProvider(stack, jsii.String("ucloud"), &ucloud.UcloudProviderConfig{
ucloudprovider.NewUcloudProvider(stack, jsii.String("ucloud"), &ucloudprovider.UcloudProviderConfig{
Region: jsii.String("cn-bj2"),
ProjectId: jsii.String(os.Getenv("UCLOUD_PROJECT_ID")),
})

images := ucloud.NewDataUcloudImages(stack, jsii.String("images"), &ucloud.DataUcloudImagesConfig{
images := dataucloudimages.NewDataUcloudImages(stack, jsii.String("images"), &dataucloudimages.DataUcloudImagesConfig{
AvailabilityZone: jsii.String("cn-bj2-04"),
NameRegex: jsii.String("^CentOS 8.2 64"),
ImageType: jsii.String("base"),
})

ucloud.NewInstance(stack, jsii.String("web"), &ucloud.InstanceConfig{
instance.NewInstance(stack, jsii.String("web"), &instance.InstanceConfig{
AvailabilityZone: jsii.String("cn-bj2-04"),
ImageId: images.Images().Get(jsii.Number(0)).Id(),
InstanceType: jsii.String("n-basic-2"),
Expand Down
10 changes: 5 additions & 5 deletions examples/java/aws/src/main/java/com/mycompany/app/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import com.hashicorp.cdktf.TerraformOutput;
import com.hashicorp.cdktf.TerraformStack;

import imports.aws.AwsProvider;
import imports.aws.datasources.DataAwsRegion;
import imports.aws.dynamodb.DynamodbTable;
import imports.aws.dynamodb.DynamodbTableAttribute;
import imports.aws.sns.SnsTopic;
import imports.aws.provider.AwsProvider;
import imports.aws.data_aws_region.DataAwsRegion;
import imports.aws.dynamodb_table.DynamodbTable;
import imports.aws.dynamodb_table.DynamodbTableAttribute;
import imports.aws.sns_topic.SnsTopic;
import software.constructs.Construct;

public class Main extends TerraformStack {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import com.hashicorp.cdktf.TerraformOutput;
import com.hashicorp.cdktf.TerraformStack;

import imports.azurerm.AzurermProvider;
import imports.azurerm.AzurermProviderFeatures;
import imports.azurerm.VirtualNetwork;
import imports.azurerm.provider.*;
import imports.azurerm.virtual_network.*;

import software.constructs.Construct;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
// DOCS_BLOCK_START:assets
import com.hashicorp.cdktf.TerraformAsset;
import com.hashicorp.cdktf.AssetType;
import imports.aws.AwsProvider;
import imports.aws.s3.*;
import imports.aws.provider.AwsProvider;
import imports.aws.s3_bucket.*;
import imports.aws.s3_bucket_object.*;
// DOCS_BLOCK_END:assets

// DOCS_BLOCK_START:constructs
import java.util.*;
import imports.kubernetes.*;
import imports.kubernetes.provider.*;
// DOCS_BLOCK_END:constructs

// DOCS_BLOCK_START:assets,constructs
Expand Down
Loading