You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`<project_id>` is in the format `<cluster_id>:<id>`, but <id> part is optional:
137
+
`<project_id>` is in the format `<cluster_id>:<id>`, this is the output from `data.rancher2_cluster.downstream_cluster.default_project_id`
138
138
139
-
- If full project_id is provided, `<project_id>=<cluster_id>:<id>`, the namespace'll be assigned to corresponding cluster project once it's imported.
140
-
- If `<id>` part is omitted `<project_id>=<cluster_id>`, the namespace'll not be assigned to any project. To move it into a project, `<project_id>=<cluster_id>:<id>` needs to be updated in tf file. Namespace movement is only supported inside same `cluster_id`.
139
+
The `<project_id>` must match the actual resource, importing will error on project mismatch.
141
140
141
+
In past versions you could modify the namespace while importing it, this functionality is no longer available.
This example module configures Rancher to deploy a downstream RKE2 cluster.
4
+
5
+
## Deploy Rancher
6
+
7
+
This module starts by using the rancher-aws module to deploy Rancher on AWS.
8
+
9
+
## Downstream
10
+
11
+
This module has a local module that provides a logical separation for deploying a downstream cluster using the rancher2_cluster_v2 resource.
12
+
13
+
## Machine Config Patch
14
+
15
+
There is a local exec that runs kubectl to patch the Amazonec2Config objects.
16
+
The AWS access key id and secret access key attributes are obfuscated and unable to be set directly in favor of the Amazonec2Credential object.
17
+
The Amazonec2Credential object doesn't support a session token making it impossible to use temporary credentials.
18
+
Our CI must use temporary AWS credentials supplied via OIDC, so this may be something that you eliminate from the example in your implementation.
19
+
We bypass the Amazonec2Credential object by manually patching the Amazonec2Config objects with the aws_access_key_id and aws_secret_access_key.
20
+
The AWS session token isn't obfuscated and is available as an argument when creating a rancher2_machine_config_v2 resource.
21
+
22
+
## Dependencies
23
+
24
+
The Flake.nix in the root of the module explains all of the dependencies for the development of the module, it also includes the dependencies to run it.
25
+
You can see the list on lines 50-80, but a more specific list is below (with explanations).
26
+
- bash -> born again shell with linux core utils
27
+
- git -> required by Terraform
28
+
- curl -> required by Terraform as well as dependent modules (when downloading RKE2 for install)
29
+
- openssh -> required by Terraform and used in dependent modules to connect to servers for initial configuration
30
+
- ssh-agent -> used for connecting to remote server for initial configuration, you need to have the key you send into the module loaded in your agent
31
+
- gh -> the github cli tool, used to find releases when downloading RKE2 for install
32
+
- jq -> json parsing tool, used in dependent modules to parse submodule outputs
33
+
- openssl -> required by Terraform and used in dependent modules to verify TLS certificates
34
+
- kubectl -> used in local exec to patch kubernetes objects
35
+
- awscli2 -> the aws cli tool, used in some dependent modules in some use cases (dualstack)
36
+
- tfswitch -> handy for installing Terraform
37
+
- yq -> yaml parsing tool, used in dependent modules to parse kubectl outputs
38
+
- go -> necessary to run tests
39
+
40
+
## Environment Variables
41
+
42
+
I like to set my AWS credentials in environment variables:
43
+
- AWS_ROLE -> role to assume when using OIDC
44
+
- AWS_REGION -> AWS region to deploy to, make sure there are multiple availability zones when needing HA
45
+
- AWS_DEFAULT_REGION -> same as region
46
+
- AWS_ACCESS_KEY_ID -> access key, this will make it into the state, please secure it properly
47
+
- AWS_SECRET_ACCESS_KEY -> secret key, this will make it into the state, please secure it properly
48
+
- AWS_SESSION_TOKEN -> used with temporary AWS credentials, this will make it into the state, please secure it properly
49
+
- TF_VAR_aws_access_key_id -> access key, this will make it into the state, please secure it properly
50
+
- TF_VAR_aws_secret_access_key -> secret key, this will make it into the state, please secure it properly
51
+
- TF_VAR_aws_session_token -> used with temporary AWS credentials, this will make it into the state, please secure it properly
52
+
- TF_VAR_aws_region -> AWS region to deploy to, make sure there are multiple availability zones when needing HA
0 commit comments