After you set up your link:https://console.redhat.com/openshift/token/rosa[offline {cluster-manager-first} token], you need to create the Terraform files locally to build your cluster. You can create these files by using the following code templates.
.Procedure
. Create the `main.tf` file by running the following command:
+
[source,terminal]
----
$ cat<<-EOF>main.tf
#
# Copyright (c) 2023 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
. Create the `variables.tf` file by running the following command:
+
[NOTE]
====
Copy and edit this file _before_ running the command to build your cluster.
====
+
[source,terminal]
----
$ cat<<-EOF>variables.tf
#
# Copyright (c) 2023 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
variable "openshift_version" {
type = string
default = "4.14.20"
description = "Desired version of OpenShift for the cluster, for example '4.14.20'. If version is greater than the currently running version, an upgrade will be scheduled."
}
variable "create_vpc" {
type = bool
description = "If you would like to create a new VPC, set this value to 'true'. If you do not want to create a new VPC, set this value to 'false'."
}
# ROSA Cluster info
variable "cluster_name" {
default = null
type = string
description = "The name of the ROSA cluster to create"
}
variable "additional_tags" {
default = {
Terraform = "true"
Environment = "dev"
}
description = "Additional AWS resource tags"
type = map(string)
}
variable "path" {
description = "(Optional) The arn path for the account/operator roles as well as their policies."
type = string
default = null
}
variable "multi_az" {
type = bool
description = "Multi AZ Cluster for High Availability"
default = true
}
variable "worker_node_replicas" {
default = 3
description = "Number of worker nodes to provision. Single zone clusters need at least 2 nodes, multizone clusters need at least 3 nodes"
type = number
}
variable "aws_subnet_ids" {
type = list(any)
description = "A list of either the public or public + private subnet IDs to use for the cluster blocks to use for the cluster"
description = "If you want to create a private cluster, set this value to 'true'. If you want a publicly available cluster, set this value to 'false'."
}
#VPC Info
variable "vpc_name" {
type = string
description = "VPC Name"
default = "tf-qs-vpc"
}
variable "vpc_cidr_block" {
type = string
description = "value of the CIDR block to use for the VPC"
default = "10.0.0.0/16"
}
variable "private_subnet_cidrs" {
type = list(any)
description = "The CIDR blocks to use for the private subnets"