Skip to content

Commit 6ca7420

Browse files
committed
trying to get rid of dependency on template
1 parent 2d447c9 commit 6ca7420

File tree

4 files changed

+35
-162
lines changed

4 files changed

+35
-162
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ nimbus-secrets.json
1212
secrets.env
1313
.envrc
1414
outputs/
15-
15+
.terraform.lock.hcl

ec2/.terraform.lock.hcl

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ec2/unison.tf

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,22 @@ resource "aws_security_group" "unison" {
3434
}
3535
}
3636

37-
locals {
38-
unison_user_data = base64encode(templatefile("${path.module}/cloud-init.yaml", {
39-
unison_cloud_image_tag = var.unison_cloud_image_tag
40-
region = data.aws_region.current.name
41-
config_template = base64encode(data.template_file.config_template.rendered)
42-
}))
43-
}
44-
45-
data "template_file" "config_template" {
46-
template = file("${path.module}/config.json.template")
47-
vars = {
48-
blob_bucket_name = aws_s3_bucket.unison_cloud_byoc_blobs.bucket
49-
services_bucket_name = aws_s3_bucket.unison_cloud_byoc_native_services.bucket
50-
cluster_token = data.http.cluster_token.response_body
51-
region = data.aws_region.current.name
52-
dynamodb_table = aws_dynamodb_table.unison_cloud_byoc_state.id
53-
cluster_name = var.cluster_name
37+
data "cloudinit_config" "unison-cloudinint" {
38+
part {
39+
merge_type = "list(append)+dict(recurse_array)+str()"
40+
content_type = "text/cloud-config"
41+
content = templatefile("${path.module}/cloud-init.yaml", {
42+
unison_cloud_image_tag = var.unison_cloud_image_tag
43+
region = data.aws_region.current.name
44+
config_template = base64encode(templatefile("${path.module}/config.json.template", {
45+
blob_bucket_name = aws_s3_bucket.unison_cloud_byoc_blobs.bucket
46+
services_bucket_name = aws_s3_bucket.unison_cloud_byoc_native_services.bucket
47+
cluster_token = data.http.cluster_token.response_body
48+
region = data.aws_region.current.name
49+
dynamodb_table = aws_dynamodb_table.unison_cloud_byoc_state.id
50+
cluster_name = var.cluster_name
51+
}))
52+
})
5453
}
5554
}
5655

@@ -69,7 +68,7 @@ resource "aws_launch_template" "unison" {
6968
name = aws_iam_instance_profile.unison.name
7069
}
7170

72-
user_data = local.unison_user_data
71+
user_data = data.cloudinit_config.unison-cloudinint.rendered
7372

7473
tag_specifications {
7574
resource_type = "instance"

eks/.terraform.lock.hcl

Lines changed: 0 additions & 143 deletions
This file was deleted.

0 commit comments

Comments
 (0)