Giới thiệu về Terraform init Introduction to Terraform init ការចូលទៅក្នុង Terraform init
Hướng dẫn chi tiết đồng bộ từ docs Cloudflare — mỗi section có backlink tới đúng vị trí trên trang gốc. Detailed guide synced from Cloudflare docs — each section links to the matching anchor on the official page. មគ្គុទ្ទេសក៍លម្អិតធ្វើសមកាលពី docs Cloudflare — ផ្នែកនីមួយៗមានតំណទៅទីតាំងត្រូវគ្នានៅទំព័រផ្លូវការ។
← Danh mục ← Catalog ← បញ្ជីGiải thích nhanh Quick context បរិបទរហ័ស
Thuộc nhóm Application Services — tập trung bảo vệ, tăng tốc và vận hành ứng dụng/web phía trước origin. Tutorial «1 – Initialize Terraform» giúp bạn làm quen luồng triển khai thật — phù hợp đọc trước khi mở tài liệu gốc tiếng Anh. Docs gốc chia khoảng 3 bước chính; bản tóm tắt dưới đây giúp bạn nắm khung trước khi làm theo từng lệnh.
This tutorial shows you how to get started with Terraform. You will create a DNS record pointing www.example.com to a web server at 203.0.113.10.
វគ្គបណ្តុះបណ្តាលនេះបង្ហាញអ្នកពីរបៀបដើម្បី get started ជាមួយ Terraform ។ អ្នកនឹងបង្កើតឯកសារ DNS ដែលបង្ហាញ www.example.com ទៅលើបណ្តាញនៅ 203.0.113.10 ។
Lưu ý Note ចំណាំ
Lưu ý trước khi làm Notes before you start ចំណាំមុនពេលចាប់ផ្តើម
- Đây là bản tóm tắt trên Orange Cloud Learning Hub — không thay thế tài liệu chính thức.
- Luôn mở liên kết «Tài liệu gốc» bên dưới khi cần lệnh CLI, snippet code và ảnh minh họa đầy đủ.
- Kiểm tra token/API và state backend trước khi chạy trên môi trường production.
- Docs Cloudflare cập nhật thường xuyên — đối chiếu ngày «Rà soát lần cuối» trên trang gốc khi triển khai production.
- This is a summary on Orange Cloud Learning Hub — it does not replace the official documentation.
- Open the Official docs link below for CLI commands, code snippets, and full screenshots.
- Verify API tokens and the state backend before running against production.
- Cloudflare docs change frequently — verify the Last reviewed date on the official page before production use.
- នេះគឺជាការបញ្ជាក់អំពី Orange Cloud Learning Hub — វាគឺជាការផ្លាស់ប្តូរនៃឯកសារផ្លូវការ។
- ចុចតំណភ្ជាប់ Docs Official នៅខាងក្រោមសម្រាប់ការបញ្ជា CLI, សៀវភៅកូដនិងរូបថតពេញលេញ។
- សូមពិនិត្យមើល API tokens និងការបង្វិលប្រព័ន្ធប្រតិបត្តិការមុនពេលធ្វើការប្រឆាំងនឹងការផលិត។
- Cloudflare បានផ្លាស់ប្តូរជាធម្មតានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅ។
Overview Overview Overview
Tutorial này hướng dẫn bạn get started with Terraform. You just signed up your domain ( example.com ) on Cloudflare to manage everything in Terraform and now you will create a DNS record pointing www.example.com to a web server at 203.0.113.10 .
Read the "Overview" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «Overview» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
example.com) trên Cloudflare để quản lý mọi thứ trong Terraform và bây giờ bạn sẽ tạo một bản ghi DNS chỉ www.example.com đến một máy chủ web tại 203.0.113.10.example.com) on Cloudflare to manage everything in Terraform and now you will create a DNS record pointing www.example.com to a web server at 203.0.113.10.example.com) នៅ Cloudflare ដើម្បីគ្រប់គ្រងទាំងអស់នៅក្នុង Terraform ហើយឥឡូវនេះអ្នកនឹងបង្កើតអាសយដ្ឋាន DNS ដែលបង្ហាញ www.example.com ទៅលើបណ្តាញនៅ 203.0.113.10 ។- Installed Terraform
- Created an API Token với quyền chỉnh sửa tài nguyên cho hướng dẫn này
- Installed Terraform
- Created an API Token with permissions to edit resources for this tutorial
- Installed Terraform
- Created an API Token ជាមួយនឹងការអនុញ្ញាតឱ្យធ្វើតេស្តឧបករណ៍សម្រាប់ការធ្វើតេស្តនេះ
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)
1.Điều Tạo cấu hình của bạn 1. Create your configuration 1 ។ បានបង្កើត Configuration របស់អ្នក
Tạo file named main.tf , filling in your own values for the API token , zone ID , account ID , and domain :
Read the "1. Create your configuration" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «1 ។ បានបង្កើត Configuration របស់អ្នក» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
main.tf, điền các giá trị của riêng bạn cho API token, zone ID, account ID và domain:main.tf, filling in your own values for the API token, zone ID, account ID, and domain:main.tf និងបំពេញតម្លៃរបស់អ្នកសម្រាប់ API token, zone ID, account ID និង domain:terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 5"
}
}
}
provider "cloudflare" {
api_token = "<YOUR_API_TOKEN>"
}
variable "zone_id" {
default = "<YOUR_ZONE_ID>"
}
variable "account_id" {
default = "<YOUR_ACCOUNT_ID>"
}
variable "domain" {
default = "<YOUR_DOMAIN>"
}
resource "cloudflare_dns_record" "www" {
zone_id = "<YOUR_ZONE_ID>"
name = "www"
content = "203.0.113.10"
type = "A"
ttl = 1
proxied = true
comment = "Domain verification record"
} Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)
2.Đối với Bắt đầu và lập kế hoạch 2. Initialize and plan 2 ។ ការចាប់ផ្តើមនិងការរចនា
Phần «Khởi tạo và plan» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "2. Initialize and plan" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «2 ។ ការចាប់ផ្តើមនិងការរចនា» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
terraform init terraform plan Terraform used the selected providers to generate the following execution plan. Resource actions are
indicated with the following symbols:
+ create
Terraform will perform the following actions:
# cloudflare_dns_record.www will be created
+ resource "cloudflare_dns_record" "www" {
+ comment = "Domain verification record"
+ comment_modified_on = (known after apply)
+ content = "203.0.113.10"
+ created_on = (known after apply)
+ id = (known after apply)
+ meta = (known after apply)
+ modified_on = (known after apply)
+ name = "www"
+ proxiable = (known after apply)
+ proxied = true
+ settings = (known after apply)
+ tags = (known after apply)
+ tags_modified_on = (known after apply)
+ ttl = 1
+ type = "A"
+ zone_id = "<YOUR_ZONE_ID>"
}
Plan: 1 to add, 0 to change, 0 to destroy. 3 Cái Ứng dụng và Verify 3. Apply and verify 3 ។ ការអនុវត្តនិងការត្រួតពិនិត្យ
Phần «Apply và verify» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "3. Apply and verify" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «3 ។ ការអនុវត្តនិងការត្រួតពិនិត្យ» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
terraform apply yes khi được nhắc.yes when prompted.yes នៅពេលដែលអ្នកកំពុងទាញយកTerraform used the selected providers to generate the following execution plan. Resource actions are
indicated with the following symbols:
+ create
Terraform will perform the following actions:
# cloudflare_dns_record.www will be created
+ resource "cloudflare_dns_record" "www" {
+ comment = "Domain verification record"
+ comment_modified_on = (known after apply)
+ content = "203.0.113.10"
+ created_on = (known after apply)
+ id = (known after apply)
+ meta = (known after apply)
+ modified_on = (known after apply)
+ name = "www"
+ proxiable = (known after apply)
+ proxied = true
+ settings = (known after apply)
+ tags = (known after apply)
+ tags_modified_on = (known after apply)
+ ttl = 1
+ type = "A"
+ zone_id = "<YOUR_ZONE_ID>"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
cloudflare_dns_record.www: Creating...
cloudflare_dns_record.www: Creation complete after 0s
Apply complete! Resources: 1 added, 0 changed, 0 destroyed. dig www.example.com curl https://www.example.com Hello, this is 203.0.113.10! terraform show {"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/terraform/","name":"Terraform"}},{"@type":"ListItem","position":3,"item":{"@id":"/terraform/tutorial/","name":"Tutorials"}},{"@type":"ListItem","position":4,"item":{"@id":"/terraform/tutorial/initialize-terraform/","name":"1 – Initialize Terraform"}}]} Xem bản đầy đủ trên developers.cloudflare.com (ảnh, tab cấu hình). View the full guide on developers.cloudflare.com (images, config tabs). មើលមគ្គុទ្ទេសក៍ពេញលើ developers.cloudflare.com (រូបភាព, tab កំណត់)។
Tài liệu gốc ↗ Official docs ↗ ឯកសារផ្លូវការ ↗