Skip to content

Commit 1191bff

Browse files
author
Guan Gui
committed
Add working example for CloudFlare Routes and Workers
1 parent e793b4b commit 1191bff

16 files changed

Lines changed: 147 additions & 6 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ cover.out
55
/vendor
66
/.vendor-new
77
.DS_Store
8+
/local
89

910
# ignore IDE folders
1011
.vscode/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
PROJECT_NAME := provider-jet-cloudflare
55
PROJECT_REPO := github.com/guiguan/$(PROJECT_NAME)
66

7-
export TERRAFORM_VERSION := 1.1.6
7+
export TERRAFORM_VERSION := 1.2.5
88

99
export TERRAFORM_PROVIDER_SOURCE := cloudflare/cloudflare
1010
export TERRAFORM_PROVIDER_VERSION := 3.19.0

apis/worker/v1alpha1/zz_generated.deepcopy.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/worker/v1alpha1/zz_generated.resolvers.go

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/worker/v1alpha1/zz_route_types.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/worker/v1alpha1/zz_script_types.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/worker/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,12 @@ import "github.com/crossplane/terrajet/pkg/config"
55
// Configure configures individual resources by adding custom ResourceConfigurators.
66
func Configure(p *config.Provider) {
77
p.AddResourceConfigurator("cloudflare_worker_script", func(r *config.Resource) {
8+
r.ExternalName = config.IdentifierFromProvider
9+
})
10+
p.AddResourceConfigurator("cloudflare_worker_route", func(r *config.Resource) {
11+
r.ExternalName = config.IdentifierFromProvider
12+
r.References["script_name"] = config.Reference{
13+
Type: "Script",
14+
}
815
})
916
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apiVersion: cloudflare.jet.crossplane.io/v1alpha1
22
kind: ProviderConfig
33
metadata:
4-
name: default
4+
name: cloudflare-provider
55
spec:
66
credentials:
77
source: Secret
88
secretRef:
9-
name: example-creds
9+
name: cloudflare-provider
1010
namespace: crossplane-system
1111
key: credentials

examples/providerconfig/secret.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: Secret
33
metadata:
4-
name: example-creds
4+
name: cloudflare-provider
55
namespace: crossplane-system
66
type: Opaque
77
stringData:

examples/worker/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
route.yaml

0 commit comments

Comments
 (0)