You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -14,301 +14,96 @@ Sometimes, you may have to roll back configuration changes. For example, you mig
14
14
15
15
To revert your configuration, check out the desired branch and ask Terraform to move your Cloudflare settings back in time. If you accidentally brought your site down, consider establishing a good strategy for peer reviewing pull requests rather than merging directly to `master` as done in the tutorials for brevity.
Another benefit of storing your Cloudflare configuration in Git is that you can see who made the change. You can also see who reviewed and approved the change if you peer-review pull requests.
This shows the most recent commit and what files changed.
203
42
204
-
## 3. Redeploy the previous configuration
43
+
## 2. Scenario: Revert the Page Rules
205
44
206
45
Assume that shortly after you deployed the Page Rules when following the [Add exceptions with Page Rules](/terraform/tutorial/add-page-rules/) tutorial, you are told the URL is no longer needed, and the security setting and redirect should be dropped.
207
46
208
47
While you can always edit the config file directly and delete those entries, you can use Git to do that for you.
209
48
210
-
### i. Revert the branch to the previous commit
211
-
212
-
Run the following Git command to revert the last commit without rewriting history:
213
-
214
-
```sh
215
-
git revert HEAD~1..HEAD
216
-
```
217
-
218
-
```sh output
219
-
[master f9a6f7d] Revert "Step 6 - Bug fix."
220
-
1 file changed, 1 insertion(+), 1 deletion(-)
221
-
```
49
+
### Revert using Git
50
+
Use Git to create a revert commit that undoes the Page Rules changes:
222
51
223
52
```sh
224
-
git log -2
53
+
git revert HEAD
225
54
```
55
+
Git will open your default editor with a commit message. Save and close to accept the default message, or customize it:
226
56
227
57
```sh output
228
-
commit f9a6f7db72ea1437e146050a5e7556052ecc9a1a
229
-
Author: Me
230
-
Date: Wed Apr 18 23:28:09 2018 -0700
58
+
Revert "Add Page Rules for security and redirects"
231
59
232
-
Revert "Step 5 - Add two Page Rules."
233
-
234
-
This reverts commit d4fec164581bec44684a4d59bb80aec1f1da5a6e.
235
-
236
-
commit d4fec164581bec44684a4d59bb80aec1f1da5a6e
237
-
Author: Me
238
-
Date: Wed Apr 18 22:04:52 2018 -0700
239
-
240
-
Step 5 - Add two Page Rules.
60
+
This reverts commit f1a2b3c4d5e6f7a8b9c0d1e2f3g4h5i6j7k8l9m0.
241
61
```
242
62
243
-
### ii. Preview the changes
63
+
##3. Preview the changes
244
64
245
-
Run `terraform plan` and check the execution plan:
65
+
Check what Terraform will do with the reverted configuration:
246
66
247
67
```sh
248
68
terraform plan
249
69
```
250
-
70
+
Expected output:
251
71
```sh output
252
-
Refreshing Terraform state in-memory prior to plan...
253
-
The refreshed state will be used to calculate this plan, but will not be
Two resources were destroyed, as expected, and you have rolled back to the previous version.
98
+
99
+
## 5. Verify the revert
100
+
Test that the Page Rules are no longer active:
101
+
```bash
102
+
# This should now return 404 (no redirect)
103
+
curl -I https://www.example.com/old-location.php
104
+
105
+
# This should return normal response (no Under Attack mode)
106
+
curl -I https://www.example.com/expensive-db-call
107
+
```
108
+
109
+
Your configuration has been successfully reverted. The Page Rules are removed, and your zone settings are back to the previous state. Git's version control ensures you can always recover or revert changes safely.
0 commit comments