Skip to content

Commit 30aa6e0

Browse files
authored
feat: update cloudflare to use account api tokens over user api tokens (#4783)
Closes: #4759 This updates cloudflare integration docs to guide the user to use an account api token in favour of the user api tokens. Account API tokens are preferred over user api tokens for long running integrations. --------- Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
1 parent 240c62e commit 30aa6e0

2 files changed

Lines changed: 48 additions & 82 deletions

File tree

docs/components/Cloudflare.mdx

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,29 @@ import { CardGrid, LinkCard } from "@astrojs/starlight/components";
5454

5555
## Instructions
5656

57-
## Create a Cloudflare API Token
58-
59-
1. Open the [Cloudflare API Tokens page](https://dash.cloudflare.com/profile/api-tokens)
60-
2. Click **Create Token**
61-
3. Click **Get started** next to "Create Custom Token"
62-
4. Configure the token:
63-
- **Token name**: SuperPlane Integration
64-
- **Permissions** (click "+ Add more" to add each):
65-
- Zone / Zone / Read
66-
- Zone / DNS / Edit
67-
- Zone / Cache Purge / Purge
68-
- Zone / SSL and Certificates / Edit
69-
- Zone / Single Redirect / Edit
70-
- Zone / Origin Rules / Edit
71-
- Zone / Workers Routes / Edit
72-
- Zone / Load Balancers / Edit
73-
- Account / Workers KV Storage / Edit
74-
- Account / Workers Scripts / Edit
75-
- Account / Workers / Edit
76-
- Account / Load Balancing: Monitors and Pools / Edit
77-
- Account / Notifications / Edit
78-
- Account / Account Settings / Edit
79-
- Account / Cloudflare Tunnel / Edit
80-
- **Zone Resources**: Include / All zones _(or select specific zones)_
81-
- **Account Resources**: Include the account containing your load balancers
82-
5. Click **Continue to summary**, then **Create Token**
83-
6. Copy the token and paste it below
84-
85-
## Find your Cloudflare Account ID
86-
87-
The **Account ID** is required for KV storage, load balancing monitors/pools, Cloudflare Tunnels, and health alert webhooks.
88-
89-
1. Open the [Cloudflare dashboard](https://dash.cloudflare.com/)
90-
2. Select the account that contains your load balancers
91-
3. In the account home page, copy the **Account ID** from the right sidebar
92-
4. Paste it into the **Account ID** field below
93-
94-
Make sure this is the same account selected in **Account Resources** when creating the API token.
95-
96-
> **Note**: The token is only shown once. Store it securely if needed elsewhere.
57+
To connect Cloudflare to SuperPlane:
58+
59+
1. In the [Cloudflare dashboard](https://dash.cloudflare.com/), open the account you want to connect, then go to **Manage Account → Account API Tokens** and click **Create Token → Create Custom Token**. Creating an account-owned token requires **Super Administrator** access on the Cloudflare account.
60+
2. Name the token and keep the first policy scoped to **Entire Account**. Select these permissions:
61+
- **Developer Platform****Workers KV Storage****Edit**
62+
- **Developer Platform****Workers Scripts****Edit**
63+
- **Developer Platform****Workers****Edit**
64+
- **Network Services****Account Load Balancers****Edit**
65+
- **Network Services****Load Balancing: Monitors and Pools****Edit**
66+
- **Account & Billing****Notifications****Edit**
67+
- **Account & Billing****Account Settings****Edit**
68+
- **Cloudflare One****Cloudflare Tunnel****Edit**
69+
3. Click **Add policy**. In the new policy, change the scope dropdown from **Entire Account** to **All Domains** or **Specified Domains** for only the domains SuperPlane should manage. The DNS and zone rows below are only available after switching this policy to a domain scope:
70+
- **DNS & Zones****Zone****Read**
71+
- **DNS & Zones****DNS****Edit**
72+
- **Caching****Cache Purge****Purge**
73+
- **SSL and Certificates****SSL and Certificates****Edit**
74+
- **Rules & Configuration****Dynamic URL Redirects****Edit**
75+
- **Rules & Configuration****Origin****Edit**
76+
- **Developer Platform****Workers Routes****Edit**
77+
- **Network Services****Zone Load Balancers****Edit**
78+
4. Optionally set an expiration date, review, create the token, and paste the generated token below. Cloudflare only shows the token once.
79+
5. Copy the **Account ID** from the same account's home page right sidebar and paste it into **Account ID** below.
9780

9881
<a id="on-load-balancing-health-alert"></a>
9982

pkg/integrations/cloudflare/cloudflare.go

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -176,57 +176,40 @@ func (c *Cloudflare) Description() string {
176176
}
177177

178178
func (c *Cloudflare) Instructions() string {
179-
return `## Create a Cloudflare API Token
180-
181-
1. Open the [Cloudflare API Tokens page](https://dash.cloudflare.com/profile/api-tokens)
182-
2. Click **Create Token**
183-
3. Click **Get started** next to "Create Custom Token"
184-
4. Configure the token:
185-
- **Token name**: SuperPlane Integration
186-
- **Permissions** (click "+ Add more" to add each):
187-
- Zone / Zone / Read
188-
- Zone / DNS / Edit
189-
- Zone / Cache Purge / Purge
190-
- Zone / SSL and Certificates / Edit
191-
- Zone / Single Redirect / Edit
192-
- Zone / Origin Rules / Edit
193-
- Zone / Workers Routes / Edit
194-
- Zone / Load Balancers / Edit
195-
- Account / Workers KV Storage / Edit
196-
- Account / Workers Scripts / Edit
197-
- Account / Workers / Edit
198-
- Account / Load Balancing: Monitors and Pools / Edit
199-
- Account / Notifications / Edit
200-
- Account / Account Settings / Edit
201-
- Account / Cloudflare Tunnel / Edit
202-
- **Zone Resources**: Include / All zones _(or select specific zones)_
203-
- **Account Resources**: Include the account containing your load balancers
204-
5. Click **Continue to summary**, then **Create Token**
205-
6. Copy the token and paste it below
206-
207-
## Find your Cloudflare Account ID
208-
209-
The **Account ID** is required for KV storage, load balancing monitors/pools, Cloudflare Tunnels, and health alert webhooks.
210-
211-
1. Open the [Cloudflare dashboard](https://dash.cloudflare.com/)
212-
2. Select the account that contains your load balancers
213-
3. In the account home page, copy the **Account ID** from the right sidebar
214-
4. Paste it into the **Account ID** field below
215-
216-
Make sure this is the same account selected in **Account Resources** when creating the API token.
217-
218-
> **Note**: The token is only shown once. Store it securely if needed elsewhere.`
179+
return `To connect Cloudflare to SuperPlane:
180+
181+
1. In the [Cloudflare dashboard](https://dash.cloudflare.com/), open the account you want to connect, then go to **Manage Account → Account API Tokens** and click **Create Token → Create Custom Token**. Creating an account-owned token requires **Super Administrator** access on the Cloudflare account.
182+
2. Name the token and keep the first policy scoped to **Entire Account**. Select these permissions:
183+
- **Developer Platform** → **Workers KV Storage** → **Edit**
184+
- **Developer Platform** → **Workers Scripts** → **Edit**
185+
- **Developer Platform** → **Workers** → **Edit**
186+
- **Network Services** → **Account Load Balancers** → **Edit**
187+
- **Network Services** → **Load Balancing: Monitors and Pools** → **Edit**
188+
- **Account & Billing** → **Notifications** → **Edit**
189+
- **Account & Billing** → **Account Settings** → **Edit**
190+
- **Cloudflare One** → **Cloudflare Tunnel** → **Edit**
191+
3. Click **Add policy**. In the new policy, change the scope dropdown from **Entire Account** to **All Domains** or **Specified Domains** for only the domains SuperPlane should manage. The DNS and zone rows below are only available after switching this policy to a domain scope:
192+
- **DNS & Zones** → **Zone** → **Read**
193+
- **DNS & Zones** → **DNS** → **Edit**
194+
- **Caching** → **Cache Purge** → **Purge**
195+
- **SSL and Certificates** → **SSL and Certificates** → **Edit**
196+
- **Rules & Configuration** → **Dynamic URL Redirects** → **Edit**
197+
- **Rules & Configuration** → **Origin** → **Edit**
198+
- **Developer Platform** → **Workers Routes** → **Edit**
199+
- **Network Services** → **Zone Load Balancers** → **Edit**
200+
4. Optionally set an expiration date, review, create the token, and paste the generated token below. Cloudflare only shows the token once.
201+
5. Copy the **Account ID** from the same account's home page right sidebar and paste it into **Account ID** below.`
219202
}
220203

221204
func (c *Cloudflare) Configuration() []configuration.Field {
222205
return []configuration.Field{
223206
{
224207
Name: "apiToken",
225-
Label: "API Token",
208+
Label: "Account-Owned API Token",
226209
Type: configuration.FieldTypeString,
227210
Required: true,
228211
Sensitive: true,
229-
Description: "Cloudflare API Token with appropriate permissions",
212+
Description: "Cloudflare account-owned API token with the permissions listed above",
230213
},
231214
{
232215
Name: "accountId",

0 commit comments

Comments
 (0)