add node name variable & adjust tailscale up flags
This commit is contained in:
		@ -3,4 +3,4 @@ echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
 | 
			
		||||
echo 'net.ipv6.conf.all.forwarding = 1' >> /etc/sysctl.conf
 | 
			
		||||
sysctl -p /etc/sysctl.conf
 | 
			
		||||
curl -fsSL https://gist.githubusercontent.com/bdeshi/ba8fed1b5d357320d0314e8380c58454/raw/4978c0b60443e448607b59bc67c09f1dbbac9a56/tailscale-install.sh | sh
 | 
			
		||||
tailscale up %{ if length(routes) > 0 } --advertise-routes "${join(",", routes)}" %{ endif } %{ if exit_node } --advertise-exit-node %{ endif } --authkey "${auth_key}" --accept-dns=false
 | 
			
		||||
tailscale up --accept-dns=false --accept-routes=false --hostname "${node_name}" %{ if length(routes) > 0 } --advertise-routes "${join(",", routes)}" %{ endif } %{ if exit_node } --advertise-exit-node %{ endif } --authkey "${auth_key}"
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,7 @@ resource "aws_instance" "tailscale" {
 | 
			
		||||
    routes    = local.tailscale_routes
 | 
			
		||||
    auth_key  = tailscale_tailnet_key.relay_auth.key
 | 
			
		||||
    exit_node = var.advertise_exit_node
 | 
			
		||||
    node_name = var.relay_node_name
 | 
			
		||||
  })
 | 
			
		||||
  tags = {
 | 
			
		||||
    Name = "tailscale"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								variables.tf
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								variables.tf
									
									
									
									
									
								
							@ -17,7 +17,17 @@ variable "tailscale_api_key" {
 | 
			
		||||
  description = "The tailscale API key to use."
 | 
			
		||||
  validation {
 | 
			
		||||
    condition     = can(regex("^tskey-", var.tailscale_api_key))
 | 
			
		||||
    error_message = "The tailscale API key must start with `tskey-`"
 | 
			
		||||
    error_message = "The tailscale API key must start with `tskey-`."
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "relay_node_name" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  default     = "tailscale-relay"
 | 
			
		||||
  description = "The name of the relay node in tailscale network."
 | 
			
		||||
  validation {
 | 
			
		||||
    condition     = can(regex("^\\w+$", var.relay_node_name))
 | 
			
		||||
    error_message = "tailscale node name must be alphanumeric."
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -40,7 +50,7 @@ variable "relay_instance_type" {
 | 
			
		||||
variable "relay_key_name" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  default     = "default"
 | 
			
		||||
  description = "The name of the pre-existing key pair to use for ssh access to the relay server."
 | 
			
		||||
  description = "Name of key pair to use for the relay server, or empty to disable ssh access."
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "aws_region" {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user