Skip to content

feat: pre-existing network #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# Summary

This repository can be used as a module to create a ROSA cluster with the following components:
This repository is intended to show an example of a starting point for implementing your own ROSA automation. This
example provisions the following:

- ROSA networking in either private/public architecture
- ROSA networking in either private/public architecture (you may pass your pre-existing subnet IDs if you have a pre-existing network)
- ROSA cluster in either [Classic](https://docs.openshift.com/rosa/architecture/rosa-architecture-models.html#rosa-classic-architecture_rosa-architecture-models)
or [Hosted Control Plane](https://docs.openshift.com/rosa/architecture/rosa-architecture-models.html#rosa-hcp-architecture_rosa-architecture-models) architecture
- [Default machine pool](https://docs.openshift.com/rosa/rosa_cluster_admin/rosa_nodes/rosa-nodes-machinepools-about.html) with desired replica count
- Local HTPasswd [identity provider](https://docs.openshift.com/rosa/authentication/sd-configuring-identity-providers.html) with an "admin" user with Cluster Admin privileges
- Local HTPasswd [identity provider](https://docs.openshift.com/rosa/authentication/sd-configuring-identity-providers.html) with an "developer" user with basic privileges


# Usage
# Usage as Example

This is the desired workflow for consuming this repository. There are a couple good examples of how to
use this in our upstream documentation:

- [Provision a ROSA Classic Cluster with Terraform](https://cloud.redhat.com/experts/rosa/terraform/classic/)
- [Provision a ROSA Hosted Control Plane Cluster with Terraform](https://cloud.redhat.com/experts/rosa/terraform/hcp/)


# Usage as Module

The following Terraform is an example file to deploy a public ROSA cluster via this module. This file
can be created wherever you would like to run Terraform from as a `main.tf` file. A complete list of variables
Expand All @@ -19,6 +29,9 @@ and modifications is available via the [variables.tf](variables.tf) file:
**NOTE:** this is an overly simplistic file to demonstrate a simple installation. You will need to tailor your
automation to your needs. If there is functionality that is missing that you would like to see, please open an issue!

**WARN:** this repository is not tested to the level of many community Terraform modules, although it is versioned. Please
consider this when consuming this repository as a Terraform module.

```
variable "token" {
type = string
Expand Down
4 changes: 2 additions & 2 deletions bastion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ resource "aws_security_group" "bastion_host" {

description = "Security group for Bastion access"
name = "${var.cluster_name}-bastion"
vpc_id = module.network.vpc_id
vpc_id = local.vpc_id

# TODO: we technically should not need this if we are using sshuttle
ingress {
Expand All @@ -71,7 +71,7 @@ resource "aws_instance" "bastion_host" {

ami = data.aws_ami.rhel9[0].id
instance_type = "t2.micro"
subnet_id = module.network.private_subnet_ids[0]
subnet_id = local.private_subnet_ids[0]
key_name = aws_key_pair.bastion_host[0].key_name
vpc_security_group_ids = [aws_security_group.bastion_host[0].id]

Expand Down
6 changes: 3 additions & 3 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data "aws_region" "current" {}
#
locals {
# networking
subnet_ids = var.private ? module.network.private_subnet_ids : concat(module.network.private_subnet_ids, module.network.public_subnet_ids)
subnet_ids = var.private ? local.private_subnet_ids : concat(local.private_subnet_ids, local.public_subnet_ids)

# autoscaling
autoscaling = var.max_replicas != null
Expand Down Expand Up @@ -46,7 +46,7 @@ resource "rhcs_cluster_rosa_classic" "rosa" {
aws_private_link = var.private
aws_subnet_ids = local.subnet_ids
machine_cidr = var.vpc_cidr
availability_zones = module.network.private_subnet_azs
availability_zones = local.availability_zones
multi_az = var.multi_az
pod_cidr = var.pod_cidr
service_cidr = var.service_cidr
Expand Down Expand Up @@ -94,7 +94,7 @@ resource "rhcs_cluster_rosa_hcp" "rosa" {
private = var.private
aws_subnet_ids = local.subnet_ids
machine_cidr = var.vpc_cidr
availability_zones = module.network.private_subnet_azs
availability_zones = local.availability_zones
pod_cidr = var.pod_cidr
service_cidr = var.service_cidr

Expand Down
4 changes: 0 additions & 4 deletions modules/terraform-rosa-networking/.gitignore

This file was deleted.

18 changes: 0 additions & 18 deletions modules/terraform-rosa-networking/data.tf

This file was deleted.

11 changes: 0 additions & 11 deletions modules/terraform-rosa-networking/internet_gateway.tf

This file was deleted.

16 changes: 0 additions & 16 deletions modules/terraform-rosa-networking/locals.tf

This file was deleted.

35 changes: 0 additions & 35 deletions modules/terraform-rosa-networking/nat_gateway.tf

This file was deleted.

27 changes: 0 additions & 27 deletions modules/terraform-rosa-networking/output.tf

This file was deleted.

8 changes: 0 additions & 8 deletions modules/terraform-rosa-networking/provider.tf

This file was deleted.

71 changes: 0 additions & 71 deletions modules/terraform-rosa-networking/route.tf

This file was deleted.

39 changes: 0 additions & 39 deletions modules/terraform-rosa-networking/subnet.tf

This file was deleted.

19 changes: 0 additions & 19 deletions modules/terraform-rosa-networking/test/multi-az/main.tf

This file was deleted.

31 changes: 0 additions & 31 deletions modules/terraform-rosa-networking/test/single-az/main.tf

This file was deleted.

Loading