Complete examples

This commit is contained in:
Abel Luck 2025-06-03 13:33:14 +02:00
parent 9fe172e8f2
commit 7724c245d5
10 changed files with 263 additions and 6 deletions

View file

@ -10,7 +10,64 @@ description: |-
Generates obfs4 state and certificate for Tor bridges using external relay identity keys
## Example Usage
```terraform
# Copyright (c) Abel Luck <abel@guardianproject.info>
# SPDX-License-Identifier: GPL-3.0-or-later
terraform {
required_providers {
tor = {
source = "guardianproject/tor"
}
}
}
provider "tor" {}
# Example: Generate obfs4 state using existing identity keys
resource "tor_relay_identity_rsa" "bridge" {
key_size = 2048
}
resource "tor_relay_identity_ed25519" "bridge" {}
resource "tor_obfs4_state" "example" {
rsa_identity_private_key = tor_relay_identity_rsa.bridge.private_key_pem
ed25519_identity_private_key = tor_relay_identity_ed25519.bridge.private_key_pem
}
output "certificate" {
description = "obfs4 certificate for bridge line generation"
value = tor_obfs4_state.example.certificate
}
output "iat_mode" {
description = "obfs4 IAT mode setting"
value = tor_obfs4_state.example.iat_mode
}
output "state_json" {
description = "Complete obfs4 state in JSON format"
value = tor_obfs4_state.example.state_json
sensitive = true
}
# Example: Generate complete bridge line using all components
data "tor_obfs4_bridge_line" "example" {
ip_address = "203.0.113.1"
port = 9001
identity_fingerprint_sha1 = tor_relay_identity_rsa.bridge.public_key_fingerprint_sha1
obfs4_state_certificate = tor_obfs4_state.example.certificate
obfs4_state_iat_mode = tor_obfs4_state.example.iat_mode
}
output "bridge_line" {
description = "Complete bridge line for clients"
value = data.tor_obfs4_bridge_line.example.bridge_line
}
```
<!-- schema generated by tfplugindocs -->
## Schema