Skip to content

Commit fcc4097

Browse files
committed
Providers local and template removed/Readme updated/data replaced with templatefile
1 parent b80aef7 commit fcc4097

File tree

4 files changed

+9
-28
lines changed

4 files changed

+9
-28
lines changed

README.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,14 @@ terraform state rm module.tailscale.tailscale_tailnet_key.this
9999
|------|---------|
100100
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >=1.2.0 |
101101
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >=4.30.0 |
102-
| <a name="requirement_local"></a> [local](#requirement\_local) | ~> 1.2 |
103102
| <a name="requirement_tailscale"></a> [tailscale](#requirement\_tailscale) | 0.13.13 |
104-
| <a name="requirement_template"></a> [template](#requirement\_template) | >=2.2 |
105103

106104
## Providers
107105

108106
| Name | Version |
109107
|------|---------|
110108
| <a name="provider_aws"></a> [aws](#provider\_aws) | >=4.30.0 |
111109
| <a name="provider_tailscale"></a> [tailscale](#provider\_tailscale) | 0.13.13 |
112-
| <a name="provider_template"></a> [template](#provider\_template) | >=2.2 |
113110

114111
## Modules
115112

@@ -128,7 +125,6 @@ No modules.
128125
| [tailscale_tailnet_key.this](https://registry.terraform.io/providers/tailscale/tailscale/0.13.13/docs/resources/tailnet_key) | resource |
129126
| [aws_ami.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source |
130127
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
131-
| [template_file.ec2_user_data](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source |
132128

133129
## Inputs
134130

@@ -137,7 +133,7 @@ No modules.
137133
| <a name="input_allowed_cidr_blocks"></a> [allowed\_cidr\_blocks](#input\_allowed\_cidr\_blocks) | List of network subnets that are allowed. According to PCI-DSS, CIS AWS and SOC2 providing a default wide-open CIDR is not secure. | `list(string)` | n/a | yes |
138134
| <a name="input_ami_id"></a> [ami\_id](#input\_ami\_id) | Optional AMI ID for Tailscale instance. Otherwise latest Amazon Linux will be used. One might want to lock this down to avoid unexpected upgrades. | `string` | `""` | no |
139135
| <a name="input_api_token"></a> [api\_token](#input\_api\_token) | Tailscale API access token | `string` | n/a | yes |
140-
| <a name="input_asg"></a> [asg](#input\_asg) | Scaling settings of an Auto Scaling Group | `map(any)` | <pre>{<br/> "max_size": 1,<br/> "min_size": 1<br/>}</pre> | no |
136+
| <a name="input_asg"></a> [asg](#input\_asg) | Scaling settings of an Auto Scaling Group | `map(any)` | <pre>{<br> "max_size": 1,<br> "min_size": 1<br>}</pre> | no |
141137
| <a name="input_ec2_key_pair_name"></a> [ec2\_key\_pair\_name](#input\_ec2\_key\_pair\_name) | EC2 key pair name to use for Tailscale instance | `string` | n/a | yes |
142138
| <a name="input_env"></a> [env](#input\_env) | Environment name (typically dev/prod) | `string` | n/a | yes |
143139
| <a name="input_ext_security_groups"></a> [ext\_security\_groups](#input\_ext\_security\_groups) | External security groups to add to the Tailscale instance | `list(any)` | `[]` | no |
@@ -152,7 +148,7 @@ No modules.
152148
| <a name="input_ssm_role_arn"></a> [ssm\_role\_arn](#input\_ssm\_role\_arn) | SSM role to attach to a Tailscale instance | `string` | `"arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM"` | no |
153149
| <a name="input_subnets"></a> [subnets](#input\_subnets) | Subnets where the Taiscale instance will be placed. It is recommended to use a private subnet for better security. | `list(string)` | n/a | yes |
154150
| <a name="input_tags"></a> [tags](#input\_tags) | AWS tags for the Tailscale instance | `map(string)` | `{}` | no |
155-
| <a name="input_tailscale_tags"></a> [tailscale\_tags](#input\_tailscale\_tags) | List of Tailscale tags for the Tailnet device. It would be automatically tagged when it is authenticated with this key | `set(string)` | `[]` | no |
151+
| <a name="input_tailscale_tags"></a> [tailscale\_tags](#input\_tailscale\_tags) | List of Tailscale tags for the Tailnet device. It would be automatically tagged when it is authenticated with this key | `list(string)` | `[]` | no |
156152
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID where the Tailscale instance will be placed | `string` | n/a | yes |
157153

158154
## Outputs
@@ -162,4 +158,4 @@ No modules.
162158
| <a name="output_autoscaling_group_id"></a> [autoscaling\_group\_id](#output\_autoscaling\_group\_id) | n/a |
163159
| <a name="output_name"></a> [name](#output\_name) | n/a |
164160
| <a name="output_security_group_id"></a> [security\_group\_id](#output\_security\_group\_id) | n/a |
165-
<!-- END_TF_DOCS -->
161+
<!-- END_TF_DOCS -->

data.tf

-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
# Tailscale instance user data
2-
data "template_file" "ec2_user_data" {
3-
template = file("${path.module}/templates/ec2_user_data.tpl.yml")
4-
5-
vars = {
6-
auth_key = tailscale_tailnet_key.this.key
7-
advertise_routes = join(",", var.allowed_cidr_blocks)
8-
hostname = local.name
9-
}
10-
}
11-
121
# Instance AMI
132
data "aws_ami" "this" {
143
most_recent = true

main.tf

+6-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ resource "aws_launch_template" "this" {
3636
instance_initiated_shutdown_behavior = "terminate"
3737
instance_type = var.instance_type
3838
key_name = var.ec2_key_pair_name
39-
user_data = base64encode(data.template_file.ec2_user_data.rendered)
40-
update_default_version = true
39+
user_data = base64encode(templatefile("${path.module}/templates/ec2_user_data.tpl.yml", {
40+
auth_key = tailscale_tailnet_key.this.key
41+
advertise_routes = join(",", var.allowed_cidr_blocks)
42+
hostname = local.name
43+
}))
44+
update_default_version = true
4145
monitoring {
4246
enabled = var.monitoring_enabled
4347
}

versions.tf

-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ terraform {
44
source = "hashicorp/aws"
55
version = ">=4.30.0"
66
}
7-
template = {
8-
source = "hashicorp/template"
9-
version = ">=2.2"
10-
}
11-
local = {
12-
source = "hashicorp/local"
13-
version = "~> 1.2"
14-
}
157
tailscale = {
168
source = "tailscale/tailscale"
179
version = "0.13.13"

0 commit comments

Comments
 (0)