forked from coreos/tectonic-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3.tf
65 lines (54 loc) · 2.24 KB
/
s3.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
data "aws_region" "current" {
current = true
}
resource "aws_s3_bucket" "tectonic" {
# Buckets must start with a lower case name and are limited to 63 characters,
# so we prepend the letter 'a' and use the md5 hex digest for the case of a long domain
# leaving 29 chars for the cluster name.
bucket = "${var.tectonic_aws_assets_s3_bucket_name == "" ? format("%s%s-%s", "a", var.tectonic_cluster_name, md5(format("%s-%s", data.aws_region.current.name , var.tectonic_base_domain))) : var.tectonic_aws_assets_s3_bucket_name }"
acl = "private"
tags = "${merge(map(
"Name", "${var.tectonic_cluster_name}-tectonic",
"KubernetesCluster", "${var.tectonic_cluster_name}",
"tectonicClusterID", "${module.tectonic.cluster_id}"
), var.tectonic_aws_extra_tags)}"
lifecycle {
ignore_changes = ["*"]
}
}
# Bootkube / Tectonic assets
resource "aws_s3_bucket_object" "tectonic_assets" {
bucket = "${aws_s3_bucket.tectonic.bucket}"
key = "assets.zip"
source = "${data.archive_file.assets.output_path}"
acl = "private"
# To be on par with the current Tectonic installer, we only do server-side
# encryption, using AES256. Eventually, we should start using KMS-based
# client-side encryption.
server_side_encryption = "AES256"
tags = "${merge(map(
"Name", "${var.tectonic_cluster_name}-tectonic-assets",
"KubernetesCluster", "${var.tectonic_cluster_name}",
"tectonicClusterID", "${module.tectonic.cluster_id}"
), var.tectonic_aws_extra_tags)}"
lifecycle {
ignore_changes = ["*"]
}
}
# kubeconfig
resource "aws_s3_bucket_object" "kubeconfig" {
bucket = "${aws_s3_bucket.tectonic.bucket}"
key = "kubeconfig"
content = "${module.bootkube.kubeconfig}"
acl = "private"
# The current Tectonic installer stores bits of the kubeconfig in KMS. As we
# do not support KMS yet, we at least offload it to S3 for now. Eventually,
# we should consider using KMS-based client-side encryption, or uploading it
# to KMS.
server_side_encryption = "AES256"
tags = "${merge(map(
"Name", "${var.tectonic_cluster_name}-kubeconfig",
"KubernetesCluster", "${var.tectonic_cluster_name}",
"tectonicClusterID", "${module.tectonic.cluster_id}"
), var.tectonic_aws_extra_tags)}"
}