generated from terraform-modules/template_aws_submodules
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move more examples, add more readmes
- Loading branch information
Showing
14 changed files
with
328 additions
and
110 deletions.
There are no files selected for viewing
This file contains 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,4 @@ | ||
| locals { | ||
| region = var.region | ||
| } | ||
|
|
This file contains 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 @@ | ||
| ../prefixes.tf |
This file contains 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,5 @@ | ||
| data "aws_ebs_default_kms_key" "current" {} | ||
|
|
||
| data "aws_kms_key" "ebs_key" { | ||
| key_id = data.aws_ebs_default_kms_key.current.key_arn | ||
| } |
This file contains 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 @@ | ||
| ../version.tf |
This file contains 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 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 |
|---|---|---|
| @@ -1,84 +1,66 @@ | ||
| ```console | ||
| % kubectl -n kube-system get pods -o wide | ||
| NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES | ||
| aws-load-balancer-controller-54fdf64896-jzwsr 1/1 Running 0 23h 10.194.26.74 ip-10-194-26-252.ec2.internal <none> <none> | ||
| aws-load-balancer-controller-54fdf64896-qqt6d 1/1 Running 0 23h 10.194.24.242 ip-10-194-24-49.ec2.internal <none> <none> | ||
| aws-node-29kmc 1/1 Running 0 7d1h 10.194.24.90 ip-10-194-24-90.ec2.internal <none> <none> | ||
| aws-node-6d8ls 1/1 Running 1 7d1h 10.194.25.120 ip-10-194-25-120.ec2.internal <none> <none> | ||
| aws-node-6vrbg 1/1 Running 1 7d1h 10.194.26.252 ip-10-194-26-252.ec2.internal <none> <none> | ||
| aws-node-ldgxc 1/1 Running 1 7d1h 10.194.24.49 ip-10-194-24-49.ec2.internal <none> <none> | ||
| coredns-65bfc5645f-g86rx 1/1 Running 0 7d2h 10.194.24.207 ip-10-194-24-90.ec2.internal <none> <none> | ||
| coredns-65bfc5645f-xj9rl 1/1 Running 0 7d2h 10.194.24.69 ip-10-194-24-90.ec2.internal <none> <none> | ||
| efs-csi-controller-65fb886fd4-7slw6 3/3 Running 0 2d21h 10.194.24.90 ip-10-194-24-90.ec2.internal <none> <none> | ||
| efs-csi-controller-65fb886fd4-vcf9l 3/3 Running 0 2d21h 10.194.25.120 ip-10-194-25-120.ec2.internal <none> <none> | ||
| efs-csi-node-6t6v6 3/3 Running 0 2d21h 10.194.25.120 ip-10-194-25-120.ec2.internal <none> <none> | ||
| efs-csi-node-kxqfb 3/3 Running 0 2d21h 10.194.24.49 ip-10-194-24-49.ec2.internal <none> <none> | ||
| efs-csi-node-p8hzn 3/3 Running 0 2d21h 10.194.26.252 ip-10-194-26-252.ec2.internal <none> <none> | ||
| efs-csi-node-xxq9h 3/3 Running 0 2d21h 10.194.24.90 ip-10-194-24-90.ec2.internal <none> <none> | ||
| kube-proxy-78n7f 1/1 Running 0 7d1h 10.194.24.90 ip-10-194-24-90.ec2.internal <none> <none> | ||
| kube-proxy-cms7c 1/1 Running 0 7d1h 10.194.24.49 ip-10-194-24-49.ec2.internal <none> <none> | ||
| kube-proxy-h2t6n 1/1 Running 0 7d1h 10.194.26.252 ip-10-194-26-252.ec2.internal <none> <none> | ||
| kube-proxy-jkxnz 1/1 Running 0 7d1h 10.194.25.120 ip-10-194-25-120.ec2.internal <none> <none> | ||
| ``` | ||
| # common-services | ||
|
|
||
| This is a directory where the common services are setup: | ||
|
|
||
| * cert-manager | ||
| * istio service mesh | ||
| * metrics-server | ||
|
|
||
| ## Setup Steps | ||
|
|
||
| First, copy the `remote_state.yml` from the parent and update `directory` to be the current directory. | ||
|
|
||
| ## Terraform Automated | ||
|
|
||
| A `tf-run.data` file exists here, so the simplest way to implemnt is with the `tf-run.sh` script. | ||
|
|
||
| * copy the `remote_state.yml` from the parent and update `directory` to be the current directory | ||
| * run the tf-run.sh | ||
|
|
||
| ```console | ||
| % kubectl get pods --all-namespaces -o wide | ||
| NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES | ||
| cert-manager cert-manager-7fcbc79fc5-xwt4s 1/1 Running 0 51m 10.194.24.138 ip-10-194-24-49.ec2.internal <none> <none> | ||
| cert-manager cert-manager-cainjector-6b7f4575f4-xpgnc 1/1 Running 0 51m 10.194.24.56 ip-10-194-24-49.ec2.internal <none> <none> | ||
| cert-manager cert-manager-webhook-6cd54b96fc-rvld4 1/1 Running 0 51m 10.194.24.170 ip-10-194-24-90.ec2.internal <none> <none> | ||
| istio-system istio-egressgateway-7fcc58ddf7-dtx25 1/1 Running 0 95m 10.194.26.120 ip-10-194-26-252.ec2.internal <none> <none> | ||
| istio-system istio-ingressgateway-75f76c546b-vx2v6 1/1 Running 0 95m 10.194.24.8 ip-10-194-24-90.ec2.internal <none> <none> | ||
| istio-system istiod-85b6f86f94-vqfj2 1/1 Running 0 95m 10.194.25.155 ip-10-194-25-120.ec2.internal <none> <none> | ||
| kube-system aws-load-balancer-controller-54fdf64896-jzwsr 1/1 Running 0 23h 10.194.26.74 ip-10-194-26-252.ec2.internal <none> <none> | ||
| kube-system aws-load-balancer-controller-54fdf64896-qqt6d 1/1 Running 0 23h 10.194.24.242 ip-10-194-24-49.ec2.internal <none> <none> | ||
| kube-system aws-node-29kmc 1/1 Running 0 7d1h 10.194.24.90 ip-10-194-24-90.ec2.internal <none> <none> | ||
| kube-system aws-node-6d8ls 1/1 Running 1 7d1h 10.194.25.120 ip-10-194-25-120.ec2.internal <none> <none> | ||
| kube-system aws-node-6vrbg 1/1 Running 1 7d1h 10.194.26.252 ip-10-194-26-252.ec2.internal <none> <none> | ||
| kube-system aws-node-ldgxc 1/1 Running 1 7d1h 10.194.24.49 ip-10-194-24-49.ec2.internal <none> <none> | ||
| kube-system coredns-65bfc5645f-g86rx 1/1 Running 0 7d2h 10.194.24.207 ip-10-194-24-90.ec2.internal <none> <none> | ||
| kube-system coredns-65bfc5645f-xj9rl 1/1 Running 0 7d2h 10.194.24.69 ip-10-194-24-90.ec2.internal <none> <none> | ||
| kube-system efs-csi-controller-65fb886fd4-7slw6 3/3 Running 0 2d21h 10.194.24.90 ip-10-194-24-90.ec2.internal <none> <none> | ||
| kube-system efs-csi-controller-65fb886fd4-vcf9l 3/3 Running 0 2d21h 10.194.25.120 ip-10-194-25-120.ec2.internal <none> <none> | ||
| kube-system efs-csi-node-6t6v6 3/3 Running 0 2d21h 10.194.25.120 ip-10-194-25-120.ec2.internal <none> <none> | ||
| kube-system efs-csi-node-kxqfb 3/3 Running 0 2d21h 10.194.24.49 ip-10-194-24-49.ec2.internal <none> <none> | ||
| kube-system efs-csi-node-p8hzn 3/3 Running 0 2d21h 10.194.26.252 ip-10-194-26-252.ec2.internal <none> <none> | ||
| kube-system efs-csi-node-xxq9h 3/3 Running 0 2d21h 10.194.24.90 ip-10-194-24-90.ec2.internal <none> <none> | ||
| kube-system kube-proxy-78n7f 1/1 Running 0 7d1h 10.194.24.90 ip-10-194-24-90.ec2.internal <none> <none> | ||
| kube-system kube-proxy-cms7c 1/1 Running 0 7d1h 10.194.24.49 ip-10-194-24-49.ec2.internal <none> <none> | ||
| kube-system kube-proxy-h2t6n 1/1 Running 0 7d1h 10.194.26.252 ip-10-194-26-252.ec2.internal <none> <none> | ||
| kube-system kube-proxy-jkxnz 1/1 Running 0 7d1h 10.194.25.120 ip-10-194-25-120.ec2.internal <none> <none> | ||
| operators istio-operator-7cc8974d48-f2j2m 1/1 Running 0 14h 10.194.26.211 ip-10-194-26-252.ec2.internal <none> <none> | ||
| sample-alb sample-alb-8744f54f9-7w4cj 1/1 Running 0 23h 10.194.25.67 ip-10-194-25-120.ec2.internal <none> <none> | ||
| sample-alb sample-alb-8744f54f9-gs8f5 1/1 Running 0 23h 10.194.24.147 ip-10-194-24-49.ec2.internal <none> <none> | ||
| sample-alb sample-alb-8744f54f9-v6kgr 1/1 Running 0 23h 10.194.26.168 ip-10-194-26-252.ec2.internal <none> <none> | ||
| sample-elb sample-elb-69786b5f7d-d7nb4 1/1 Running 0 2d21h 10.194.26.178 ip-10-194-26-252.ec2.internal <none> <none> | ||
| sample-elb sample-elb-69786b5f7d-mw7jb 1/1 Running 0 2d21h 10.194.24.193 ip-10-194-24-49.ec2.internal <none> <none> | ||
| sample-elb sample-elb-69786b5f7d-tqz2s 1/1 Running 0 2d21h 10.194.25.96 ip-10-194-25-120.ec2.internal <none> <none> | ||
| sample-nlb sample-nlb-6cd5769dfb-n8dmd 1/1 Running 0 2d21h 10.194.25.198 ip-10-194-25-120.ec2.internal <none> <none> | ||
| sample-nlb sample-nlb-6cd5769dfb-qw8n4 1/1 Running 0 2d21h 10.194.24.132 ip-10-194-24-49.ec2.internal <none> <none> | ||
| sample-nlb sample-nlb-6cd5769dfb-t2nhp 1/1 Running 0 2d21h 10.194.26.18 ip-10-194-26-252.ec2.internal <none> <none> | ||
| % tf-run.sh apply | ||
| ``` | ||
|
|
||
| * example of the `tf-run.sh` steps | ||
|
|
||
| This is part of a larger cluster configuration, so at the end of the run it indicates another directory | ||
| to visit when done. | ||
|
|
||
| ```console | ||
| % kubectl -n istio-system get secret | grep -iE "ca-secret|tls" | ||
| istio-ca-secret istio.io/ca-root 5 7d2h | ||
| nginx-cert kubernetes.io/tls 3 6d20h | ||
| root-secret kubernetes.io/tls 3 7d14h | ||
| % tf-run.sh list | ||
| * running action=plan | ||
| * START: tf-run.sh v1.1.2 start=1636563207 end= logfile=logs/run.plan.20211110.1636563207.log (not-created) | ||
| * reading from tf-run.data | ||
| * read 23 entries from tf-run.data | ||
| > list | ||
| ** START: start=1636563207 | ||
| * 1 COMMAND> tf-directory-setup.py -l none -f | ||
| * 2 COMMAND> setup-new-directory.sh | ||
| * 3 COMMAND> tf-init -upgrade | ||
| * 4 tf-plan -target=tls_private_key.ca | ||
| * 5 tf-plan -target=tls_cert_request.ca | ||
| * 6 tf-plan -target=null_resource.ca_root_cert | ||
| * 7 tf-plan -target=null_resource.ca_files | ||
| * 8 tf-plan -target=null_resource.ca_cert | ||
| * 9 tf-plan -target=local_file.ca_bundle_cert | ||
| * 10 COMMAND> tf-directory-setup.py -l s3 | ||
| * 11 COMMENT> submit certs/*csr using command ouptut listed in apply to TCO for signing | ||
| * 12 STOP> once that is availabile, change cert_download to true | ||
| * 13 COMMAND> terraform taint null_resource.ca_cert | ||
| * 14 tf-plan -target=null_resource.ca_root_cert | ||
| * 15 tf-plan -target=null_resource.ca_files | ||
| * 16 tf-plan -target=null_resource.ca_cert | ||
| * 17 COMMENT> second run is to complete the steps | ||
| * 18 tf-plan -target=null_resource.ca_root_cert | ||
| * 19 tf-plan -target=null_resource.ca_files | ||
| * 20 tf-plan -target=null_resource.ca_cert | ||
| * 21 tf-plan | ||
| * 22 COMMENT> run: git-secret add certs/*.key; git-secret hide | ||
| * 23 COMMENT> be sure to add all files to git, and be sure to commit -a to get .gitsecret/ changes | ||
| ** END: start=1636563207 end=1636563207 elapsed=0 logfile=logs/run.plan.20211110.1636563207.log (not-created) | ||
| ``` | ||
|
|
||
| kubectl get pods --all-namespaces -o wide|grep -i cert | ||
| cert-manager cert-manager-7fcbc79fc5-xwt4s 1/1 Running 0 7d22h 10.194.24.138 ip-10-194-24-49.ec2.internal <none> <none> | ||
| cert-manager cert-manager-cainjector-6b7f4575f4-xpgnc 1/1 Running 0 7d22h 10.194.24.56 ip-10-194-24-49.ec2.internal <none> <none> | ||
| cert-manager cert-manager-webhook-6cd54b96fc-rvld4 1/1 Running 0 7d22h 10.194.24.170 ip-10-194-24-90.ec2.internal <none> <none> | ||
| It is highly recommended to use the `tf-run.sh` approach. | ||
|
|
||
| $ kubectl -n cert-manager get secrets | ||
| NAME TYPE | ||
| DATA AGE | ||
| ca-key-pair Opaque | ||
| 2 5m2s | ||
| ... | ||
| $ kubectl get clusterissuer | ||
| NAME READY AGE | ||
| clusterissuer True 5m36s | ||
| ## Terraform Manual | ||
|
|
Oops, something went wrong.