Skip to content

Commit f38587b

Browse files
committed
use cdktf-provider-gen to generate constrcuts
1 parent 8d3b3ae commit f38587b

104 files changed

Lines changed: 800 additions & 496 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,21 @@ This repo contains the generated code for [cdktf](https://github.com/hashicorp/t
44

55
This package is only used internally at Sourcegraph - the generated code is public for ease of use and avoid performance issue with large amount of generated content being tracked in a Git repository.
66

7-
## Development
7+
## Usage
88

99
### Adding a new provider or module to CDKTF
1010

11-
Edit [`cdktf.json`](./cdktf.json), and make sure modules and providers are pinned to a specific version. e.g.
12-
13-
```json
14-
{
15-
"terraformProviders": [
16-
{
17-
"name": "google",
18-
"source": "hashicorp/google",
19-
"version": "~> 4.38.0"
20-
}
21-
],
22-
"terraformModules": [
23-
{
24-
"name": "googlesqldb",
25-
"source": "git::https://github.com/michaellzc/terraform-google-sql-db//modules/postgresql?ref=feat/support-dynamic-iam-users"
26-
}
27-
]
28-
}
29-
```
30-
31-
Run the command below to auto-gen codes for added providers or modules:
32-
33-
```sh
34-
go generate .
35-
```
36-
37-
Commit all generated changes.
11+
Follow https://github.com/sourcegraph/cdktf-provider-gen#usage
3812

3913
### Upgrading CDKTF
4014

4115
Review the [changelog](https://developer.hashicorp.com/terraform/cdktf/release#upgrade-guides) of the target release.
4216
Watch out for breaking changes and adjust the upgrade plan if neccessary.
4317

44-
Bump the version in [`gen.go`](./gen.go):
45-
46-
> no `v` prefix
47-
48-
```diff
49-
--- a/gen.go
50-
+++ b/gen.go
51-
@@ -1,3 +1,3 @@
52-
package cdktf
53-
54-
-//go:generate go run . --version 0.13.3
55-
+//go:generate go run . --version 0.13.0
56-
```
57-
58-
Re-generate the providers and modules code:
59-
60-
```sh
61-
go generate ./
62-
```
63-
64-
Commit all changes in this repo. Upon merging the PR, then open another pull request in [sourcegraph/controller] to upgrade all `github.com/sourcegraph/controller-cdktf/gen/*` packages:
18+
Re-generate all providers and modules:
6519

66-
```sh
67-
go get -u github.com/sourcegraph/controller-cdktf/gen/...
20+
```bash
21+
cdktf-provider-gen -config <provider>.yaml -cdktf-version <version>
6822
```
6923

7024
## FAQ

aws.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: aws
2+
3+
provider:
4+
source: registry.terraform.io/hashicorp/aws
5+
version: 4.54.0
6+
7+
language: go
8+
9+
target:
10+
language: go
11+
moduleName: github.com/sourcegraph/controller-cdktf/gen
12+
13+
output: gen

awsvpc.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: awsvpc
2+
3+
module:
4+
source: terraform-aws-modules/vpc/aws
5+
version: "3.19.0"
6+
7+
language: go
8+
9+
target:
10+
language: go
11+
moduleName: github.com/sourcegraph/controller-cdktf/gen
12+
13+
output: gen

budget.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: budget
2+
3+
module:
4+
source: terraform-google-modules/project-factory/google//modules/budget
5+
version: "14.0.0"
6+
7+
language: go
8+
9+
target:
10+
language: go
11+
moduleName: github.com/sourcegraph/controller-cdktf/gen
12+
13+
output: gen

cloudflare.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: cloudflare
2+
3+
provider:
4+
source: registry.terraform.io/cloudflare/cloudflare
5+
version: "4.3.0"
6+
7+
language: go
8+
9+
target:
10+
language: go
11+
moduleName: github.com/sourcegraph/controller-cdktf/gen
12+
13+
output: gen

gen.go

Lines changed: 0 additions & 74 deletions
This file was deleted.

gen/aws/LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) <year> <copyright holders>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

gen/aws/go.mod

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
module github.com/sourcegraph/controller-cdktf/gen/aws
22

3-
go 1.20
3+
go 1.18
44

55
require (
6-
github.com/aws/constructs-go/constructs/v10 v10.1.167
7-
github.com/aws/jsii-runtime-go v1.79.0
6+
github.com/aws/jsii-runtime-go v1.87.0
87
github.com/hashicorp/terraform-cdk-go/cdktf v0.16.3
8+
github.com/aws/constructs-go/constructs/v10 v10.2.69
99
)
10-
11-
require github.com/Masterminds/semver/v3 v3.2.0 // indirect

gen/aws/go.sum

Lines changed: 0 additions & 8 deletions
This file was deleted.

gen/aws/jsii/aws-0.0.0.tgz

-53.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)