mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
OSDOCS-9249
This commit is contained in:
committed by
openshift-cherrypick-robot
parent
13abe0397f
commit
2240691c13
@@ -10,62 +10,41 @@ endif::[]
|
||||
= Changing your cluster and role prefix name
|
||||
:source-highlighter: coderay
|
||||
|
||||
By default, the Terraform files used in this guide create a cluster that uses the naming convention of `rosa-` with six-random letters or numbers. This Terraform plan uses your cluster name to create your account role and Operator role prefixes.
|
||||
By default, the Terraform files used in this guide create a cluster that uses the naming convention of `rosa-` followed by six-random letters or numbers. Terraform uses your cluster name to create your account role and Operator role prefixes.
|
||||
|
||||
.Sample code
|
||||
[source,terminal]
|
||||
----
|
||||
# If cluster_name is not null, use that, otherwise generate a random cluster name
|
||||
cluster_name = coalesce(var.cluster_name, "rosa-${random_string.random_name.result}")
|
||||
----
|
||||
|
||||
This code snippet from the `main.tf` file shows that if you set a name for the `cluster_name` variable, that value will be used instead of a randomly-generated string.
|
||||
You can customize your cluster and role prefix name by editing your `main.tf` file. If you set a name for the `cluster_name` variable in the `main.tf` file, this value is used instead of a randomly-generated string.
|
||||
|
||||
.Procedure
|
||||
|
||||
You can set the cluster name three different ways:
|
||||
* Choose one of the following methods to set the cluster name:
|
||||
|
||||
. You export the name of your cluster in the command line by running the following command:
|
||||
** Export the name of your cluster in the command line by running the following command:
|
||||
+
|
||||
[source,terminal]
|
||||
----
|
||||
$ export TF_VAR_cluster_name=<your_cluster_name>
|
||||
----
|
||||
|
||||
** Set a `cluster_name` value in your `terraform.tfvars` file:
|
||||
+
|
||||
After exporting this variable, you can build your Terraform cluster by running the following command:
|
||||
.`terraform.tfvars` file excerpt
|
||||
+
|
||||
[source,terminal]
|
||||
----
|
||||
$ terraform init && terraform apply
|
||||
cluster_name = "<your_cluster_name>"
|
||||
----
|
||||
|
||||
. You set a `cluster_name` value in the `terraform.tfvars` file:
|
||||
+
|
||||
[source,console]
|
||||
----
|
||||
###############################
|
||||
# General Cluster Information #
|
||||
###############################
|
||||
|
||||
# You can choose any OpenShift version that is currently supported. Make sure to use X.Y.Z when setting your version.
|
||||
rosa_openshift_version = "4.14.8"
|
||||
cluster_name = "test-tf"
|
||||
----
|
||||
+
|
||||
After setting this variable in the `terraform.tfvars` file, you can build your Terraform cluster by running the following command:
|
||||
** Enter the cluster name when prompted in the terminal:
|
||||
+
|
||||
[source,terminal]
|
||||
----
|
||||
$ terraform init && terraform apply
|
||||
----
|
||||
|
||||
. You enter the cluster name when prompted in the terminal:
|
||||
+
|
||||
[source,terraform]
|
||||
----
|
||||
FORTHCOMING
|
||||
----
|
||||
|
||||
ifeval::["{context}" == "rosa-sts-creating-a-cluster-quickly-terraform"]
|
||||
:tf-defaults:
|
||||
endif::[]
|
||||
|
||||
ifndef::tf-defaults[]
|
||||
You are ready to initiate Terraform.
|
||||
endif::tf-defaults[]
|
||||
67
modules/rosa-cluster-enable-autoscaling-terraform.adoc
Normal file
67
modules/rosa-cluster-enable-autoscaling-terraform.adoc
Normal file
@@ -0,0 +1,67 @@
|
||||
// Module included in the following assemblies:
|
||||
//
|
||||
// * rosa_install_access_delete_clusters/rosa-sts-creating-a-cluster-with-customizations-terraform.adoc
|
||||
//
|
||||
ifeval::["{context}" == "rosa-sts-creating-a-cluster-quickly-terraform"]
|
||||
:tf-defaults:
|
||||
endif::[]
|
||||
:_content-type: PROCEDURE
|
||||
[id="rosa-cluster-enable-autoscaling-terraform_{context}"]
|
||||
= Enabling autoscaling
|
||||
:source-highlighter: coderay
|
||||
|
||||
By default, the Terraform files used in this guide create a cluster with autoscaling disabled. You can enable autoscaling by editing your `main.tf` and `terraform.tfvars` files.
|
||||
|
||||
Enabling autoscaling requires you to set a maximum and minimum replicas range using the 'max_replicas' and 'min_replicas' variables.
|
||||
|
||||
[IMPORTANT]
|
||||
====
|
||||
If autoscaling is enabled, you cannot configure the worker node replicas.
|
||||
====
|
||||
|
||||
.Procedure
|
||||
|
||||
. Edit your `main.tf` file so that `autoscaling_enabled`, `min_replicas`, and `max_replicas` point to your `terraform.tfvars` file.
|
||||
+
|
||||
.Excerpt of a `main.tf` file with autoscaling enabled
|
||||
+
|
||||
[source,terminal]
|
||||
----
|
||||
autoscaling_enabled = var.autoscaling_enabled
|
||||
replicas = local.worker_node_replicas
|
||||
min_replicas = var.min_replicas
|
||||
max_replicas = var.max_replicas
|
||||
----
|
||||
|
||||
. Enable autoscaling and set a maximum and minimum replicas range in your `terraform.tfvars` file.
|
||||
|
||||
+
|
||||
Maximum and minimum replicas must be in multiples of 3 for multiple availability zone clusters.
|
||||
+
|
||||
.Excerpt of a `terraform.tfvars` file with autoscaling enabled
|
||||
+
|
||||
[source,terminal]
|
||||
----
|
||||
autoscaling_enabled = "true"
|
||||
worker_node_replicas = null
|
||||
min_replicas = "<minimum_replicas>"
|
||||
max_replicas = "<maximum_replicas>"
|
||||
----
|
||||
+
|
||||
.Example input
|
||||
+
|
||||
[source,terminal]
|
||||
----
|
||||
autoscaling_enabled = "true"
|
||||
worker_node_replicas = null
|
||||
min_replicas = "6"
|
||||
max_replicas = "15"
|
||||
----
|
||||
|
||||
ifndef::tf-defaults[]
|
||||
You are ready to initiate Terraform.
|
||||
endif::tf-defaults[]
|
||||
|
||||
ifeval::["{context}" == "rosa-sts-creating-a-cluster-quickly-terraform"]
|
||||
:!tf-defaults:
|
||||
endif::[]
|
||||
@@ -164,7 +164,7 @@ ifndef::tf-defaults[]
|
||||
+
|
||||
[NOTE]
|
||||
====
|
||||
Copy and then edit this file _before_ running the command to build your cluster.
|
||||
Copy and edit this file _before_ running the command to build your cluster.
|
||||
====
|
||||
+
|
||||
[source,terminal]
|
||||
@@ -360,7 +360,7 @@ ifndef::tf-defaults[]
|
||||
+
|
||||
[NOTE]
|
||||
====
|
||||
Copy and then edit this file _before_ running the command to build your cluster.
|
||||
Copy and edit this file _before_ running the command to build your cluster.
|
||||
====
|
||||
endif::tf-defaults[]
|
||||
+
|
||||
@@ -479,13 +479,13 @@ module "vpc" {
|
||||
EOF
|
||||
----
|
||||
|
||||
. *Optional*: Create the `terraform.tfvars` file by running the following command:
|
||||
. Create the `terraform.tfvars` file by running the following command:
|
||||
+
|
||||
[NOTE]
|
||||
====
|
||||
You can use the `terraform.tfvars` file to change your variables in one place without touching the rest of your Terraform files. If you do not create a `terraform.tfvars` file, you will be prompted for the required variables during cluster creation.
|
||||
Use the `terraform.tfvars` file to change variables in one place without modifying the rest of your Terraform files when customizing your cluster. If you do not create a `terraform.tfvars` file, you are prompted for the required variables during cluster creation.
|
||||
|
||||
Copy and then edit this file _before_ running the command to build your cluster.
|
||||
Copy and edit this file _before_ running the command to build your cluster.
|
||||
====
|
||||
+
|
||||
[source,terminal]
|
||||
@@ -533,8 +533,10 @@ EOF
|
||||
----
|
||||
endif::tf-defaults[]
|
||||
|
||||
ifdef::tf-defaults[]
|
||||
You are ready to initiate Terraform.
|
||||
endif::tf-defaults[]
|
||||
|
||||
ifeval::["{context}" == "rosa-sts-creating-a-cluster-quickly-terraform"]
|
||||
:tf-defaults:
|
||||
:!tf-defaults:
|
||||
endif::[]
|
||||
|
||||
@@ -28,7 +28,7 @@ The cluster creation process outlined below shows how to use Terraform to create
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
Clusters are customized by editing the default `main.tf`, `variables.tf`, and `terraform.tfvar` files. Cluster customizations must be performed *before* cluster creation. To customize, copy the default Terraform file from the procedure below and make the desired changes.
|
||||
You edit the default `main.tf`, `variables.tf`, and `terraform.tfvars` files to customize a cluster. Cluster customizations must be performed before you create a cluster. To customize, copy the default Terraform file from the procedure below and make the desired changes.
|
||||
====
|
||||
|
||||
include::modules/rosa-sts-cluster-terraform-setup.adoc[leveloffset=+2]
|
||||
@@ -37,9 +37,10 @@ include::modules/rosa-sts-cluster-terraform-file-creation.adoc[leveloffset=+2]
|
||||
[id="rosa-sts-creating-a-cluster-with-customizations-terraform-customizing"]
|
||||
== Terraform customization options
|
||||
|
||||
The following sections detail individual customizations you can add to your `main.tf`, `variables.tf`, and `terraform.tfvar` files.
|
||||
The following sections detail individual customizations you can add to your `main.tf`, `variables.tf`, and `terraform.tfvars` files.
|
||||
|
||||
include::modules/rosa-cluster-cluster-role-name-change.adoc[leveloffset=+2]
|
||||
include::modules/rosa-cluster-enable-autoscaling-terraform.adoc[leveloffset=+2]
|
||||
include::modules/rosa-sts-cluster-terraform-execute.adoc[leveloffset=+1]
|
||||
include::modules/rosa-sts-cluster-terraform-destroy.adoc[leveloffset=+1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user