Skip to content

Commit 5584ae4

Browse files
authored
Discard changes to src/content/partials/cloudflare-one/access/add-infrastructure-app.mdx
1 parent bb1c824 commit 5584ae4

File tree

1 file changed

+99
-102
lines changed

1 file changed

+99
-102
lines changed

src/content/partials/cloudflare-one/access/add-infrastructure-app.mdx

Lines changed: 99 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
{}
3+
34
---
45

5-
import { Tabs, TabItem, Render } from "~/components";
6+
import { Tabs, TabItem, Render } from "~/components"
7+
68

79
<Tabs syncKey="dashPlusAPI">
810
<TabItem label="Dashboard">
@@ -24,63 +26,61 @@ import { Tabs, TabItem, Render } from "~/components";
2426
- **SSH user**: Enter the UNIX usernames that users can log in as (for example, `root` or `ec2-user`).
2527
- **Allow users to log in as their email alias**: (Optional) When selected, users who match your policy definition will be able to access the target using their lowercased email address prefix. For example, `[email protected]` could log in as `jdoe`.
2628

27-
:::note
28-
Cloudflare will not create new users on the target. UNIX users must already be present on the server.
29-
:::
30-
29+
:::note
30+
Cloudflare will not create new users on the target. UNIX users must already be present on the server.
31+
:::
3132
4. Select **Add application**.
32-
33-
</TabItem>
33+
</TabItem>
3434
<TabItem label="API">
3535

3636
1. [Create an API token](/fundamentals/api/get-started/create-token/) with the following permissions:
37-
| Type | Item | Permission |
38-
| ------- | ---------------- | ---------- |
39-
| Account | Access: Apps & Policies | Edit |
40-
41-
1. Make a `POST` request to the [Access applications](/api/resources/zero_trust/subresources/access/subresources/applications/methods/create/) endpoint:
42-
43-
```sh
44-
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/apps \
45-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
46-
--header "Content-Type: application/json" \
47-
--data '{
48-
"name": "Example infrastructure app",
49-
"type": "infrastructure",
50-
"target_criteria": [
51-
{
52-
"target_attributes": {
53-
"hostname": [
54-
"infra-access-target"
55-
]
56-
},
57-
"port": 22,
58-
"protocol": "SSH"
59-
}
60-
],
61-
"policies": [
62-
{
63-
"name": "Allow a specific email",
64-
"decision": "allow",
65-
"include": [
66-
{
67-
"email": {
68-
"email": "[email protected]"
69-
}
70-
}
71-
],
72-
"connection_rules": {
73-
"ssh": {
74-
"usernames": [
75-
"root",
76-
"ec2-user"
77-
]
78-
}
79-
}
80-
}
81-
]
82-
}'
83-
```
37+
| Type | Item | Permission |
38+
| ------- | ---------------- | ---------- |
39+
| Account | Access: Apps & Policies | Edit |
40+
41+
2. Make a `POST` request to the [Access applications](/api/resources/zero_trust/subresources/access/subresources/applications/methods/create/) endpoint:
42+
43+
```sh
44+
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/access/apps \
45+
--header "Authorization: Bearer <API_TOKEN>" \
46+
--header "Content-Type: application/json" \
47+
--data '{
48+
"name": "Example infrastructure app",
49+
"type": "infrastructure",
50+
"target_criteria": [
51+
{
52+
"target_attributes": {
53+
"hostname": [
54+
"infra-access-target"
55+
]
56+
},
57+
"port": 22,
58+
"protocol": "SSH"
59+
}
60+
],
61+
"policies": [
62+
{
63+
"name": "Allow a specific email",
64+
"decision": "allow",
65+
"include": [
66+
{
67+
"email": {
68+
"email": "[email protected]"
69+
}
70+
}
71+
],
72+
"connection_rules": {
73+
"ssh": {
74+
"usernames": [
75+
"root",
76+
"ec2-user"
77+
]
78+
}
79+
}
80+
}
81+
]
82+
}'
83+
```
8484

8585
</TabItem>
8686
<TabItem label="Terraform (v4)">
@@ -89,54 +89,51 @@ import { Tabs, TabItem, Render } from "~/components";
8989
The following example requires Cloudflare provider version `>=4.45.0`.
9090
:::
9191

92-
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/api_token):
93-
94-
- `Access: Apps and Policies Write`
95-
96-
2. Use the [`cloudflare_zero_trust_access_application`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/zero_trust_access_application) resource to create an infrastructure application:
97-
98-
```tf
99-
resource "cloudflare_zero_trust_access_application" "infra-app" {
100-
account_id = var.cloudflare_account_id
101-
name = "Example infrastructure app"
102-
type = "infrastructure"
103-
104-
target_criteria {
105-
port = 22
106-
protocol = "SSH"
107-
target_attributes {
108-
name = "hostname"
109-
values = ["infra-access-target"]
110-
}
111-
}
112-
}
113-
```
114-
115-
3. Use the [`cloudflare_zero_trust_access_policy`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/zero_trust_access_policy) resource to add an infrastructure policy to the application:
116-
117-
```tf
118-
resource "cloudflare_zero_trust_access_policy" "infra-app-policy" {
119-
application_id = cloudflare_zero_trust_access_application.infra-app.id
120-
account_id = var.cloudflare_account_id
121-
name = "Allow a specific email"
122-
decision = "allow"
123-
precedence = 1
124-
125-
include {
126-
email = ["[email protected]"]
127-
}
128-
129-
connection_rules {
130-
ssh {
131-
usernames = ["root", "ec2-user"]
132-
}
133-
}
134-
}
135-
```
136-
137-
</TabItem>
138-
139-
</Tabs>
92+
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/api_token):
93+
- `Access: Apps and Policies Write`
94+
95+
2. Use the [`cloudflare_zero_trust_access_application`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/zero_trust_access_application) resource to create an infrastructure application:
96+
97+
```tf
98+
resource "cloudflare_zero_trust_access_application" "infra-app" {
99+
account_id = var.cloudflare_account_id
100+
name = "Example infrastructure app"
101+
type = "infrastructure"
102+
103+
target_criteria {
104+
port = 22
105+
protocol = "SSH"
106+
target_attributes {
107+
name = "hostname"
108+
values = ["infra-access-target"]
109+
}
110+
}
111+
}
112+
```
113+
114+
3. Use the [`cloudflare_zero_trust_access_policy`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/zero_trust_access_policy) resource to add an infrastructure policy to the application:
115+
116+
```tf
117+
resource "cloudflare_zero_trust_access_policy" "infra-app-policy" {
118+
application_id = cloudflare_zero_trust_access_application.infra-app.id
119+
account_id = var.cloudflare_account_id
120+
name = "Allow a specific email"
121+
decision = "allow"
122+
precedence = 1
123+
124+
include {
125+
email = ["[email protected]"]
126+
}
127+
128+
connection_rules {
129+
ssh {
130+
usernames = ["root", "ec2-user"]
131+
}
132+
}
133+
}
134+
```
135+
</TabItem>
136+
</Tabs>
140137

141138
The targets in this application are now secured by your infrastructure policies.
142139

0 commit comments

Comments
 (0)