Skip to content

Commit

Permalink
Re-introduce tests (#732)
Browse files Browse the repository at this point in the history
Remerging #728 after it
was reverted in #730
  • Loading branch information
VenelinMartinov authored Apr 12, 2024
1 parent acf5d56 commit 649d845
Show file tree
Hide file tree
Showing 16 changed files with 551 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .ci-mgmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
team: ecosystem

actions:
preTest:
- name: make upstream
run: |
make upstream
- name: Run provider tests
run: |
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
6 changes: 6 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,12 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: make upstream
run: |
make upstream
- name: Run provider tests
run: |
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,12 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: make upstream
run: |
make upstream
- name: Run provider tests
run: |
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,12 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: make upstream
run: |
make upstream
- name: Run provider tests
run: |
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Run tests
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/run-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
- name: make upstream
run: |
make upstream
- name: Run provider tests
run: |
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Run tests
if: matrix.testTarget == 'local'
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
Expand Down
8 changes: 6 additions & 2 deletions provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ require (
github.com/cloudflare/terraform-provider-cloudflare v1.18.2-0.20220823222840-b2cee3be8c57
github.com/pulumi/pulumi-terraform-bridge/pf v0.33.0
github.com/pulumi/pulumi-terraform-bridge/v3 v3.80.0
github.com/pulumi/providertest v0.0.11
github.com/pulumi/pulumi/sdk/v3 v3.112.0
github.com/stretchr/testify v1.9.0
)

replace github.com/cloudflare/terraform-provider-cloudflare => ../upstream
Expand Down Expand Up @@ -77,6 +80,7 @@ require (
github.com/ettle/strcase v0.1.1 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
Expand Down Expand Up @@ -166,6 +170,7 @@ require (
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/natefinch/atomic v1.0.1 // indirect
github.com/nxadm/tail v1.4.11 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/opentracing/basictracer-go v1.1.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
Expand All @@ -184,7 +189,6 @@ require (
github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.9-0.20240403143912-aaea88a50769 // indirect
github.com/pulumi/pulumi-yaml v1.6.0 // indirect
github.com/pulumi/pulumi/pkg/v3 v3.112.0 // indirect
github.com/pulumi/pulumi/sdk/v3 v3.112.0 // indirect
github.com/pulumi/schema-tools v0.1.2 // indirect
github.com/pulumi/terraform-diff-reader v0.0.2 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
Expand All @@ -202,7 +206,6 @@ require (
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
Expand Down Expand Up @@ -245,6 +248,7 @@ require (
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/frand v1.4.2 // indirect
Expand Down
21 changes: 21 additions & 0 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,9 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSGFplbWBSHaGolEQlNLgMgSE3ccnIQ=
Expand All @@ -1793,6 +1796,12 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U=
github.com/gkampitakis/ciinfo v0.3.0 h1:gWZlOC2+RYYttL0hBqcoQhM7h1qNkVqvRCV1fOvpAv8=
github.com/gkampitakis/ciinfo v0.3.0/go.mod h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo=
github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M=
github.com/gkampitakis/go-diff v1.3.2/go.mod h1:LLgOrpqleQe26cte8s36HTWcTmMEur6OPYerdAAS9tk=
github.com/gkampitakis/go-snaps v0.4.9 h1:x6+GEQeYWC+cnLNsHK5uXXgEQADmlH/1EqMrjfXjzk8=
github.com/gkampitakis/go-snaps v0.4.9/go.mod h1:8HW4KX3JKV8M0GSw69CvT+Jqhd1AlBPMPpBfjBI3bdY=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY=
github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4=
Expand Down Expand Up @@ -2629,6 +2638,8 @@ github.com/nightlyone/lockfile v1.0.0 h1:RHep2cFKK4PonZJDdEl4GmkabuhbsRMgk/k3uAm
github.com/nightlyone/lockfile v1.0.0/go.mod h1:rywoIealpdNse2r832aiD9jRk8ErCatROs6LzC841CI=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc=
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
Expand Down Expand Up @@ -3007,7 +3018,15 @@ github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ
github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc/go.mod h1:eyZnKCc955uh98WQvzOm0dgAeLnf2O0Rz0LPoC5ze+0=
github.com/texttheater/golang-levenshtein v1.0.1 h1:+cRNoVrfiwufQPhoMzB6N0Yf/Mqajr6t1lOv8GyGE2U=
github.com/texttheater/golang-levenshtein v1.0.1/go.mod h1:PYAKrbF5sAiq9wd+H82hs7gNaen0CplQ9uvm6+enD/8=
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
Expand Down Expand Up @@ -3659,6 +3678,7 @@ golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -4273,6 +4293,7 @@ gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76
gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI=
gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/telebot.v3 v3.0.0/go.mod h1:7rExV8/0mDDNu9epSrDm/8j22KLaActH1Tbee6YjzWg=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
Expand Down
126 changes: 126 additions & 0 deletions provider/provider_program_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
//go:build !go && !nodejs && !python && !dotnet
// +build !go,!nodejs,!python,!dotnet

package cloudflare

import (
"os"
"path/filepath"
"testing"

"github.com/stretchr/testify/require"

"github.com/pulumi/providertest"
"github.com/pulumi/providertest/optproviderupgrade"
"github.com/pulumi/providertest/pulumitest"
"github.com/pulumi/providertest/pulumitest/assertpreview"
"github.com/pulumi/providertest/pulumitest/opttest"
"github.com/pulumi/pulumi/sdk/v3/go/auto"
)

const (
providerName = "cloudflare"
defaultBaselineVersion = "5.25.0"
)

var programs = []string{
"test-programs/index_workerscript",
"test-programs/index_workerskvnamespace",
}

func TestUpgradeCoverage(t *testing.T) {
providertest.ReportUpgradeCoverage(t)
}

type UpgradeTestOpts struct {
baselineVersion string
assertFunc func(*testing.T, auto.PreviewResult)
config map[string]string
}

func WithBaselineVersion(baselineVersion string) func(opts *UpgradeTestOpts) {
return func(opts *UpgradeTestOpts) {
opts.baselineVersion = baselineVersion
}
}

func WithAssertFunc(assertFunc func(*testing.T, auto.PreviewResult)) func(opts *UpgradeTestOpts) {
return func(opts *UpgradeTestOpts) {
opts.assertFunc = assertFunc
}
}

func WithConfig(config map[string]string) func(opts *UpgradeTestOpts) {
return func(opts *UpgradeTestOpts) {
opts.config = config
}
}

func testProviderUpgrade(t *testing.T, dir string, opts ...func(*UpgradeTestOpts)) {
options := &UpgradeTestOpts{}
for _, o := range opts {
o(options)
}
testProviderUpgradeWithOpts(t, dir, options.baselineVersion, options.config, options.assertFunc)
}

func testProviderUpgradeWithOpts(
t *testing.T, dir, baselineVersion string, config map[string]string,
assertFunction func(*testing.T, auto.PreviewResult),
) {
if testing.Short() {
t.Skipf("Skipping in testing.Short() mode, assuming this is a CI run without credentials")
}
cwd, err := os.Getwd()
require.NoError(t, err)
if baselineVersion == "" {
baselineVersion = defaultBaselineVersion
}
test := pulumitest.NewPulumiTest(t, dir,
opttest.DownloadProviderVersion(providerName, baselineVersion),
opttest.LocalProviderPath(providerName, filepath.Join(cwd, "..", "bin")),
)
for k, v := range config {
test.SetConfig(k, v)
}
result := providertest.PreviewProviderUpgrade(test, providerName, baselineVersion, optproviderupgrade.DisableAttach())
if assertFunction != nil {
assertFunction(t, result)
} else {
assertpreview.HasNoReplacements(t, result)
}
}

func testProgram(t *testing.T, dir string) {
if testing.Short() {
t.Skipf("Skipping in testing.Short() mode, assuming this is a CI run without credentials")
}
cwd, err := os.Getwd()
require.NoError(t, err)
test := pulumitest.NewPulumiTest(t, dir,
opttest.LocalProviderPath(providerName, filepath.Join(cwd, "..", "bin")),
opttest.SkipInstall(),
)
test.SetConfig("cloudflare-account-id", os.Getenv("CLOUDFLARE_ACCOUNT_ID"))
test.SetConfig("cloudflare-zone-id", os.Getenv("CLOUDFLARE_ZONE_ID"))
test.Up()
}

func TestPrograms(t *testing.T) {
for _, p := range programs {
t.Run(p, func(t *testing.T) {
testProgram(t, p)
})
}
}

func TestProgramsUpgrade(t *testing.T) {
for _, p := range programs {
t.Run(p, func(t *testing.T) {
testProviderUpgrade(t, p, WithConfig(map[string]string{
"cloudflare-account-id": os.Getenv("CLOUDFLARE_ACCOUNT_ID"),
"cloudflare-zone-id": os.Getenv("CLOUDFLARE_ZONE_ID"),
}))
})
}
}
2 changes: 2 additions & 0 deletions provider/test-programs/index_workerscript/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/Pulumi.*.yaml
36 changes: 36 additions & 0 deletions provider/test-programs/index_workerscript/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: index_workerscriptielSrtchSkfd
runtime: yaml
description: ""
config:
cloudflare-account-id:
type: string
default: ACCOUNT_ID
cloudflare-zone-id:
type: string
default: ZONE_ID
pulumi:tags:
value:
pulumi:template: https://www.pulumi.com/ai/api/project/f0297e00-7bf2-4b80-92e9-f7338375bd26.zip
resources:
myWorkerScript:
properties:
name: script${randomName.result}
accountId: ${cloudflare-account-id}
content: |
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
return new Response('Hello worker!', {
headers: { 'content-type': 'text/plain' },
})
}
type: cloudflare:WorkerScript
randomName:
properties:
length: 10
special: false
upper: false
numeric: false
type: random:RandomString
2 changes: 2 additions & 0 deletions provider/test-programs/index_workerskvnamespace/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/Pulumi.*.yaml
29 changes: 29 additions & 0 deletions provider/test-programs/index_workerskvnamespace/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: index_workerskvnamespace9PC9vCoap51M
runtime: yaml
description: A minimal Pulumi YAML program that creates a Cloudflare Workers KV Namespace with dependencies
config:
cloudflare-account-id:
type: string
default: ACCOUNT_ID
cloudflare-zone-id:
type: string
default: ZONE_ID
pulumi:tags:
value:
pulumi:template: https://www.pulumi.com/ai/api/project/66a43ab9-9d3d-4d8c-9e07-1d30e5a2ce22.zip
outputs:
kvNamespaceId: ${cloudflareWorkersKvNamespace.id}
resources:
cloudflareWorkersKvNamespace:
properties:
accountId: ${cloudflare-account-id}
title: kv-${randomId.result}
type: cloudflare:WorkersKvNamespace
randomId:
properties:
length: 6
lower: true
number: false
special: false
upper: false
type: random:RandomString
Loading

0 comments on commit 649d845

Please sign in to comment.