-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #709 This is a TS test because it cannot currently be expressed in YAML (pulumi/pulumi-yaml#562). When a version of Pulumi YAML releases with pulumi/pulumi-yaml#563, we can rewrite the test in YAML and incorporate it in our upgrade framework, making it _just another test_ like those in #719.
- Loading branch information
Showing
7 changed files
with
102 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name: regress-554 | ||
runtime: nodejs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as cloudflare from "@pulumi/cloudflare"; | ||
|
||
/* | ||
* This is a regression test for https://github.com/pulumi/pulumi-cloudflare/issues/554. | ||
* | ||
* #554 triggers when calling READ (importing) on a `cloudflare.Ruleset` with non-empty | ||
* rules values. We do this by creating a `cloudflare.Ruleset` (`ruleset`), and then | ||
* calling `cloudflare.Ruleset.get` with the ID from `ruleset`. We do it this way so we | ||
* *know* there is a valid cloudflare ruleset to import. | ||
* | ||
* We don't need to assert on the imported ruleset, since #554 presented as a panic, not | ||
* as incorrect data. | ||
*/ | ||
|
||
const accountId = pulumi.secret(process.env["CLOUDFLARE_ACCOUNT_ID"]!); | ||
|
||
const zone = cloudflare.getZoneOutput({ | ||
accountId, | ||
name: "pulumi-cloudflare-demo.com", | ||
}) | ||
|
||
const ruleset = new cloudflare.Ruleset("domain-rate-limit", { | ||
name: "domain-rate-limit", | ||
kind: "zone", | ||
zoneId: zone.zoneId, | ||
phase: "http_request_transform", | ||
|
||
rules: [{ | ||
action: "rewrite", | ||
actionParameters: { | ||
uri: { | ||
path: { | ||
value: "/my-new-route" | ||
} | ||
} | ||
}, | ||
|
||
expression: "(http.host eq \"example.com\" and http.request.uri.path eq \"/old-path\")", | ||
description: "example URI path transform rule", | ||
enabled: true, | ||
}], | ||
}); | ||
|
||
export const importName = pulumi.interpolate`zone/${zone.id}/${ruleset.id}`; | ||
|
||
cloudflare.Ruleset.get("imported", importName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "cloudflare-ruleset-import", | ||
"version": "0.1.0", | ||
"dependencies": { | ||
"@pulumi/cloudflare": "^5.0.0", | ||
"@pulumi/pulumi": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "bin", | ||
"target": "es6", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"stripInternal": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strictNullChecks": true | ||
}, | ||
"files": [ | ||
"index.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters