项目作者: kemra102

项目描述 :
This Terraform module spins up a Red Hat OpenShift Container Platform within AWS.
高级语言: HCL
项目地址: git://github.com/kemra102/terraform-redhat-ocp-quickstart.git
创建时间: 2018-01-23T14:42:27Z
项目社区:https://github.com/kemra102/terraform-redhat-ocp-quickstart

开源协议:MIT License

下载


terraform-redhat-ocp-quickstart

This Terraform module spins up a Red Hat OpenShift Container Platform within AWS.

It is based on the AWS Quickstart quickstart-redhat-openshift recipe produced by AWS.

This module tries to do away with CloudFormation completely to perform the same task with a pure Terraform code base. There are some deviations from the original template, the most obvious of these is that it is not possible to use an existing VPC, you must allow the module to build the VPC and it’s components. There are other smaller changes made in the name of hardening and otherwise making the code more production worthy based on real world deployments with clients.

Using this Module

In your code you can include the module like this:

  1. module "redhat-ocp-quickstart" {
  2. source = "github.com/kemra102/terraform-redhat-ocp-quickstart"
  3. keypair_name = "ocp"
  4. redhat_subscription_user_name = "user@example.com"
  5. redhat_subscription_password = "password"
  6. redhat_subscription_pool_id = "myocppoolid"
  7. openshift_admin_password = "password"
  8. }

The above shows the minimum amount of variables that must be provided to this module. Additonal variables can be set if you wish to override the defaults. For an explanation of the required variables and the optional ones refer to inputs.tf which includes descriptions with each variable.

NOTE: See the original Quickstart docs for how to get your RHN Pool ID if you are unsure on how to get this.

Additional Security Group Rules

You can add additional rules to this modules Security Groups by using the aws_security_group_rule Terraform resource, for example:

  1. resource "aws_security_group_rule" "stop_telneting_out" {
  2. security_group_id = "${module.redhat-ocp-quickstart.instances_security_group_id}"
  3. type = "egress"
  4. from_port = 21
  5. to_port = 21
  6. protocol = "tcp"
  7. cidr_blocks = ["0.0.0.0/0"]
  8. }

Additonal Route Table Routes

You can add additional routes to existing Route Tables by using the aws_route Terraform resource, for example:

  1. resource "aws_route" "peer" {
  2. route_table_id = "${module.redhat-ocp-quickstart.public_route_table_id)}"
  3. destination_cidr_block = "10.200.1/20"
  4. vpc_peering_connection_id = "${aws_vpc_peering_connection.logging.id}"
  5. }

Add External ELBs

By default ELBs are only created for the Master & Node instances and both are set to internal. You can optionally enable an external ELB for Master and/or Node instances, for example:

  1. module "redhat-ocp-quickstart" {
  2. source = "github.com/kemra102/terraform-redhat-ocp-quickstart"
  3. keypair_name = "ocp"
  4. redhat_subscription_user_name = "user@example.com"
  5. redhat_subscription_password = "password"
  6. redhat_subscription_pool_id = "myocppoolid"
  7. openshift_admin_password = "password"
  8. enable_external_node_elb = true
  9. }

Changing the Listeners for ELBs

The listeners for ELBs (including external ones you may enable) are defined as variables so can be overriden if desired, for example:

  1. variable "my_listeners" {
  2. default = [
  3. {
  4. to_port = 8080
  5. from_port = 8080
  6. protocol = "TCP"
  7. cidr_blocks = ["0.0.0.0/0"]
  8. }
  9. ]
  10. }
  11. module "redhat-ocp-quickstart" {
  12. source = "github.com/kemra102/terraform-redhat-ocp-quickstart"
  13. keypair_name = "ocp"
  14. redhat_subscription_user_name = "user@example.com"
  15. redhat_subscription_password = "password"
  16. redhat_subscription_pool_id = "myocppoolid"
  17. openshift_admin_password = "password"
  18. enable_external_node_elb = true
  19. ocp_node_external_elb_listeners = "${var.my_listeners}"
  20. }

License

All code in this repository unless explicitly stated otherwise is under the MIT license. Please see the LICENSE file for the full legal text of this license.