Một mục hướng lập trình viên trong kho dữ liệu GitHub của TopGit: zerotier/terraform-provider-zerotier, 83 sao, nhóm Developer Tools, Go. Terraform provider for controlling ZeroTier Central
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
ZeroTier is a smart Ethernet switch for planet Earth.
It's a distributed network hypervisor built atop a cryptographically
secure global peer to peer network. It provides advanced network
virtualization and management capabilities on par with an enterprise
SDN switch, but across both local and wide area networks, connecting
almost any kind of app or device.
It does not distinguish between on-premise, cloud, desktop, or mobile
devices. You can even ZeroTier-enable individual programs with the SDK
socket interface.
This Terraform provider allows you to manipulate objects in the ZeroTier Central API:
Networks
ZeroTier Networks can be thought of as encrypted virtual Ethernet
switches.
resource "zerotier_network" "occams_router" {
name = "occams_router"
description = "The prefix with largest number of bits is usually correct"
assignment_pool {
start = "10.1.0.1"
end = "10.1.0.254"
}
route {
target = "10.1.0.0/24"
}
flow_rules = "accept;"
}
ZeroTier networks can also push routes to network members, if they
want to receive them.
resource "zerotier_network" "schrödingers_nat" {
name = "schrödingers_nat"
description = "A packet's destination is simultaneiously Alice and Bob until observed by a NAT table."
assignment_pool {
start = "10.2.0.1"
end = "10.2.0.254"
}
route {
target = "10.2.0.0/24"
}
route {
target = "0.0.0.0/0"
via = "10.2.0.1"
}
flow_rules = "accept;"
}
ZeroTier networks have a robust flow_rules language, allowing you do
to things like dropping select traffic, or even as advanced as
Ethernet tapping. Please refer to the ZeroTier Reference Manual for
details.
resource "zerotier_network" "silence_of_the_lan" {
name = "silence_of_the_lan"
description = "It puts the bits in the bucket. It does this whenever it is told."
assignment_pool {
start = "10.3.0.1"
end = "10.3.0.254"
}
route {
target = "10.3.0.0/24"
}
flow_rules = "drop;"
}
Pre 1.0.0 versions of this provider allowed you to specify an IPv4 CIDR
instead of a start/end range. This was removed to reflect the reality
of the current Central API. If you would like to use a CIDR, please
see the ZeroTier Network Terraform Module
on the Registry, or Github
Members
Members are associations between Nodes and Networks. These are created
when a node is authorized in the WebUI.
resource "zerotier_member" "bob" {
name = "in Bob we trust"
member_id = "1234ABCDEF"
network_id = zerotier_network.schrödingers_nat.id
}
Identities
The zerotier_identity resource is the odd-ball of the bunch. You
cannot create an Identity in the API. A ZeroTier identity is the
cryptographic identity of a ZeroTier node. It is more akin to a
Terraform TLS Private Key.
In "normal" ZeroTier usage, the ZeroTier Identity is created by the ZeroTier
client on first launch. When a client tries to join a ZeroTier
Network, the public half shows up in the WebUI, waiting for
Authorization from an administrator. (A "member" association in the
API).
Without a third party to certify the validity of the identity
(Certificate Authority model), the node's identity needs to be verified
out-of-band of ZeroTier. This usually means it is Trusted on First
Use. This is the same pattern as SSH keys.
With dymamic and ephemeral infrastructure, we have the usual
chicken-and-egg problem. We cannot associate a member with a network
until we know the identity.
The zerotier_identity resource lets us pre-generate an identity
for use with a zerotier_member resource, but a freshly provisioned
instance or container will not know the secret.
Therefore, the secret part of the identity will need to somehow be installed on the node by one of:
Injection via userdata / environment
Pre-baking of the secret into the booted instance or container
Mounting of the secret as a volume
In any event, usage of the zerotier_identity resource means the
secret will be stored in the Terraform State, creating a potential
security risk, and should be documented as such.
The zerotier_token resource will return a token from the Central
API. You can use this to inject a token into containers or instance
cloud-init scripts for things that also need to talk to the Central
API.
zerotier_token "foo" {
name = "foo"
}
zerotier_token "bar" {
name = "bar"
}
Putting it all together.
This example connects two docker containers with zerotier. You can then docker exec into one and ping the other over the ZeroTier network.
And everything should be cleaned up! Note that you can do more with the allocation system to better scope your IP addresses; this is just a way to show off more that you can do.
Development
Included here is a description of the Make tasks and environment variables you need to run the tests and perform builds.
make checks: Everything you need to do to get through CI
make test
FORCE_TESTS=1: do not use test cache
QUIET_TESTS=1: do not show test log (just results)
TEST=<pattern>: run a specific test or tests that match the pattern
ZEROTIER_CENTRAL_TOKEN
set in env or write to test-token.txt at the root.
env is preferred but the token from file is just propagated to env and gitignored. No different, just easier to use.
Cleanup commands you may find useful
Sometimes tests fail and resources get left behind
docker ps -a -f name=zerotier --format {{.ID}} | xargs docker rm -f removed orphaned containers with "zerotier" in the name.
docker network prune removed orphaned networks
rm /tmp/tftest if problems downloading kreuzwerker/docker.
Delete the "hello-word" auth token from your central account.
Don't use your main central account for tests. Use an alternate. Delete it and recreate when too many networks to clean up.
zerotier/terraform-provider-zerotier thuộc nhóm Developer Tools trên TopGit, cùng 3 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về zerotier/terraform-provider-zerotier ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/zerotier/terraform-provider-zerotier là nguồn chính thức.
Vì sao zerotier/terraform-provider-zerotier được xếp vào nhóm Developer Tools?
TopGit xếp zerotier/terraform-provider-zerotier vào nhóm Developer Tools dựa trên GitHub topics và mô tả của repo (gắn thẻ: "terraform", "zerotier", "zerotier-one"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
zerotier/terraform-provider-zerotier có phải mã nguồn mở không?
Có — zerotier/terraform-provider-zerotier phát hành theo license BSD-3-Clause, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/zerotier/terraform-provider-zerotier.
zerotier/terraform-provider-zerotier có trang demo không?
Dự án có trang chủ ở https://zerotier.com. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
zerotier/terraform-provider-zerotier dùng license gì?
zerotier/terraform-provider-zerotier phát hành theo license BSD-3-Clause. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
zerotier/terraform-provider-zerotier là gì?
zerotier/terraform-provider-zerotier (zerotier/terraform-provider-zerotier) là dự án Go trên GitHub. Theo mô tả gốc: Terraform provider for controlling ZeroTier Central
Đọc đầy đủ README ở tab phía trên.
terraform-provider-zerotier có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về terraform-provider-zerotier.