Last active
August 18, 2022 19:43
-
-
Save flrichar/c8b7f791467afeb225573f25dc9bbfbf to your computer and use it in GitHub Desktop.
rancher-terraform-skeleton.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### tfvars.tf or environment.tf | |
| variable "api_url" { | |
| description = "rancher api url" | |
| default = "https://urlto.rancher-fqdn.com/v3" | |
| } | |
| variable "token_key" { | |
| description = "api key to use for tf" | |
| default = "token-nameid:jwt-long-hashy-looking-string" | |
| } | |
| ### providers.tf | |
| provider "rancher2" { | |
| api_url = var.api_url | |
| token_key = var.token_key | |
| insecure = true | |
| } | |
| ### versions.tf | |
| terraform { | |
| required_providers { | |
| rancher2 = { | |
| source = "rancher/rancher2" | |
| version = ">= 1.24.0" | |
| } | |
| } | |
| required_version = ">= 1.2.7" | |
| } | |
| ## main.tf example, just read cluster info for local | |
| ## export with 'terraform output cluster_info' | |
| data "rancher2_cluster" "local" { | |
| name = "local" | |
| } | |
| output "cluster_info" { | |
| value = data.rancher2_cluster.local | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment