This repository was archived by the owner on Feb 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 262
modules/*: trust CA certificates on the nodes #2362
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
447af6d
modules/*: trust CA certificates on the nodes
c8e828a
modules/ignition: unify etcd certificate generation
9c133ab
modules/tls/etcd: remove zip generation
fa0f3bd
*/aws: use S3 for ignition provisioning
046c277
*/azure: use unified etcd TLS ignition files
532ff5b
*/gcp: use unified etcd TLS ignition files
f328eb9
*/openstack: use unified etcd TLS ignition files
dd2e0fd
*/vmware: use unified etcd TLS ignition files
6d66b86
Documentation/examples: regenerate
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| resource "aws_s3_bucket_object" "ignition_etcd" { | ||
| count = "${length(var.external_endpoints) == 0 ? var.instance_count : 0}" | ||
|
|
||
| bucket = "${var.s3_bucket}" | ||
| key = "ignition_etcd_${count.index}.json" | ||
| content = "${data.ignition_config.etcd.*.rendered[count.index]}" | ||
| acl = "private" | ||
|
|
||
| server_side_encryption = "AES256" | ||
|
|
||
| tags = "${merge(map( | ||
| "Name", "${var.cluster_name}-ignition-etcd-${count.index}", | ||
| "KubernetesCluster", "${var.cluster_name}", | ||
| "tectonicClusterID", "${var.cluster_id}" | ||
| ), var.extra_tags)}" | ||
| } | ||
|
|
||
| data "ignition_config" "s3" { | ||
| count = "${length(var.external_endpoints) == 0 ? var.instance_count : 0}" | ||
|
|
||
| replace { | ||
| source = "${format("s3://%s/%s", var.s3_bucket, aws_s3_bucket_object.ignition_etcd.*.key[count.index])}" | ||
| verification = "sha512-${sha512(data.ignition_config.etcd.*.rendered[count.index])}" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,14 +20,88 @@ data "aws_ami" "coreos_ami" { | |
| } | ||
| } | ||
|
|
||
| resource "aws_iam_role" "etcd" { | ||
| count = "${length(var.external_endpoints) == 0 ? 1 : 0}" | ||
| name = "${var.cluster_name}-etcd-role" | ||
| path = "/" | ||
|
|
||
| assume_role_policy = <<EOF | ||
| { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Action": "sts:AssumeRole", | ||
| "Principal": { | ||
| "Service": "ec2.amazonaws.com" | ||
| }, | ||
| "Effect": "Allow", | ||
| "Sid": "" | ||
| } | ||
| ] | ||
| } | ||
| EOF | ||
| } | ||
|
|
||
| resource "aws_iam_role_policy" "etcd" { | ||
| count = "${length(var.external_endpoints) == 0 ? 1 : 0}" | ||
| name = "${var.cluster_name}_etcd_policy" | ||
| role = "${aws_iam_role.etcd.id}" | ||
|
|
||
| policy = <<EOF | ||
| { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": "ec2:Describe*", | ||
| "Resource": "*" | ||
| }, | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": "ec2:AttachVolume", | ||
| "Resource": "*" | ||
| }, | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": "ec2:DetachVolume", | ||
| "Resource": "*" | ||
| }, | ||
| { | ||
| "Action": [ | ||
| "ecr:DescribeRepositories", | ||
| "ecr:ListImages", | ||
| "ecr:BatchGetImage" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @s-urbaniak Why did you need to add ECR permissions?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might've been a copy&pasta oversight, but without this the machine didn't seem to boot. |
||
| ], | ||
| "Resource": "*", | ||
| "Effect": "Allow" | ||
| }, | ||
| { | ||
| "Action" : [ | ||
| "s3:GetObject" | ||
| ], | ||
| "Resource": "arn:aws:s3:::*", | ||
| "Effect": "Allow" | ||
| } | ||
| ] | ||
| } | ||
| EOF | ||
| } | ||
|
|
||
| resource "aws_iam_instance_profile" "etcd" { | ||
| count = "${length(var.external_endpoints) == 0 ? 1 : 0}" | ||
| name = "${var.cluster_name}-etcd-profile" | ||
| role = "${aws_iam_role.etcd.name}" | ||
| } | ||
|
|
||
| resource "aws_instance" "etcd_node" { | ||
| count = "${length(var.external_endpoints) == 0 ? var.instance_count : 0}" | ||
| ami = "${data.aws_ami.coreos_ami.image_id}" | ||
|
|
||
| iam_instance_profile = "${aws_iam_instance_profile.etcd.name}" | ||
| instance_type = "${var.ec2_type}" | ||
| subnet_id = "${element(var.subnets, count.index)}" | ||
| key_name = "${var.ssh_key}" | ||
| user_data = "${data.ignition_config.etcd.*.rendered[count.index]}" | ||
| subnet_id = "${element(var.subnets, count.index)}" | ||
| user_data = "${data.ignition_config.s3.*.rendered[count.index]}" | ||
| vpc_security_group_ids = ["${var.sg_ids}"] | ||
|
|
||
| lifecycle { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| resource "aws_s3_bucket_object" "ignition_master" { | ||
| bucket = "${var.s3_bucket}" | ||
| key = "ignition_master.json" | ||
| content = "${data.ignition_config.main.rendered}" | ||
| acl = "private" | ||
|
|
||
| server_side_encryption = "AES256" | ||
|
|
||
| tags = "${merge(map( | ||
| "Name", "${var.cluster_name}-ignition-master", | ||
| "KubernetesCluster", "${var.cluster_name}", | ||
| "tectonicClusterID", "${var.cluster_id}" | ||
| ), var.extra_tags)}" | ||
| } | ||
|
|
||
| data "ignition_config" "s3" { | ||
| replace { | ||
| source = "${format("s3://%s/%s", var.s3_bucket, aws_s3_bucket_object.ignition_master.key)}" | ||
| verification = "sha512-${sha512(data.ignition_config.main.rendered)}" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| resource "aws_s3_bucket_object" "ignition_worker" { | ||
| bucket = "${var.s3_bucket}" | ||
| key = "ignition_worker.json" | ||
| content = "${data.ignition_config.main.rendered}" | ||
| acl = "private" | ||
|
|
||
| server_side_encryption = "AES256" | ||
|
|
||
| tags = "${merge(map( | ||
| "Name", "${var.cluster_name}-ignition-worker", | ||
| "KubernetesCluster", "${var.cluster_name}", | ||
| "tectonicClusterID", "${var.cluster_id}" | ||
| ), var.extra_tags)}" | ||
| } | ||
|
|
||
| data "ignition_config" "s3" { | ||
| replace { | ||
| source = "${format("s3://%s/%s", var.s3_bucket, aws_s3_bucket_object.ignition_worker.key)}" | ||
| verification = "sha512-${sha512(data.ignition_config.main.rendered)}" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm new to Terraform and was scratching my head about this after not finding
countin theaws_s3_bucket_objectdocs. It turns out it is a meta-parameter (more here). I thought I'd add this note in case it helps any other Terraform newbies ;).