Skip to content

Commit

Permalink
updated tfe and kube config modules
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttyso committed Jul 25, 2021
1 parent 81ecf9a commit 38516e1
Show file tree
Hide file tree
Showing 11 changed files with 651 additions and 685 deletions.
5 changes: 2 additions & 3 deletions modules/kube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Run the plan from the Terraform cloud workspace.
| Name | Version |
|------|---------|
| <a name="provider_intersight"></a> [intersight](#provider\_intersight) | >=1.0.11 |
| <a name="provider_terraform"></a> [terraform](#provider\_terraform) | n/a |

## Modules

Expand All @@ -27,15 +26,15 @@ No modules.
| Name | Type |
|------|------|
| [intersight_kubernetes_cluster.kube_config](https://registry.terraform.io/providers/CiscoDevNet/intersight/latest/docs/data-sources/kubernetes_cluster) | data source |
| [terraform_remote_state.cluster](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/data-sources/remote_state) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_apikey"></a> [apikey](#input\_apikey) | Intersight API Key. | `string` | n/a | yes |
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Intersight Kubernetes Service Cluster Name | `string` | n/a | yes |
| <a name="input_endpoint"></a> [endpoint](#input\_endpoint) | Intersight URL. | `string` | `"https://intersight.com"` | no |
| <a name="input_secretkey"></a> [secretkey](#input\_secretkey) | Intersight Secret Key. | `string` | n/a | yes |
| <a name="input_tfc_organization"></a> [tfc\_organization](#input\_tfc\_organization) | Terraform Cloud Organization. | `string` | `"CiscoDevNet"` | no |

## Outputs

Expand Down
24 changes: 1 addition & 23 deletions modules/kube/main.tf
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
#__________________________________________________________
#
# Get Outputs from the Cluster Workspace
#__________________________________________________________

data "terraform_remote_state" "cluster" {
backend = "remote"
config = {
organization = var.tfc_organization
workspaces = {
name = var.ws_cluster
}
}
}

locals {
# Intersight Endpoint
endpoint = data.terraform_remote_state.cluster.outputs.endpoint
# IKS Cluster Name
cluster_moid = data.terraform_remote_state.cluster.outputs.iks_cluster
}

#______________________________________________
#
# Get kube_config from IKS Cluster
#______________________________________________

data "intersight_kubernetes_cluster" "kube_config" {
moid = local.cluster_moid.cluster_1
name = var.cluster_name
}
2 changes: 1 addition & 1 deletion modules/kube/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ terraform {

provider "intersight" {
apikey = var.apikey
endpoint = local.endpoint
endpoint = var.endpoint
secretkey = var.secretkey
}
28 changes: 17 additions & 11 deletions modules/kube/variables.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
#__________________________________________________________
#
# Terraform Cloud Organization
#__________________________________________________________

variable "tfc_organization" {
default = "CiscoDevNet"
description = "Terraform Cloud Organization."
type = string
}

#__________________________________________________________
#
# Intersight Provider Variables
Expand All @@ -20,8 +9,25 @@ variable "apikey" {
type = string
}

variable "endpoint" {
default = "https://intersight.com"
description = "Intersight URL."
type = string
}

variable "secretkey" {
description = "Intersight Secret Key."
sensitive = true
type = string
}

#__________________________________________________________
#
# Intersight Kubernetes Service Cluster Name
#__________________________________________________________

variable "cluster_name" {
description = "Intersight Kubernetes Service Cluster Name"
type = string
}

11 changes: 3 additions & 8 deletions modules/tfe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ No providers.
| <a name="module_iwo_workspaces"></a> [iwo\_workspaces](#module\_iwo\_workspaces) | terraform-cisco-modules/modules/tfe//modules/tfc_workspace | n/a |
| <a name="module_kube_variables"></a> [kube\_variables](#module\_kube\_variables) | terraform-cisco-modules/modules/tfe//modules/tfc_variables | n/a |
| <a name="module_kube_workspaces"></a> [kube\_workspaces](#module\_kube\_workspaces) | terraform-cisco-modules/modules/tfe//modules/tfc_workspace | n/a |
| <a name="module_tenant_variables"></a> [tenant\_variables](#module\_tenant\_variables) | terraform-cisco-modules/modules/tfe//modules/tfc_variables | n/a |
| <a name="module_tenant_workspace"></a> [tenant\_workspace](#module\_tenant\_workspace) | terraform-cisco-modules/modules/tfe//modules/tfc_workspace | n/a |
| <a name="module_tfc_agent_pool"></a> [tfc\_agent\_pool](#module\_tfc\_agent\_pool) | terraform-cisco-modules/modules/tfe//modules/tfc_agent_pool | n/a |

## Resources
Expand All @@ -240,10 +238,9 @@ No resources.
| <a name="input_dns_servers_v4"></a> [dns\_servers\_v4](#input\_dns\_servers\_v4) | DNS Servers for Kubernetes Sysconfig Policy. | `list(string)` | <pre>[<br> "198.18.0.100",<br> "198.18.0.101"<br>]</pre> | no |
| <a name="input_domain_name"></a> [domain\_name](#input\_domain\_name) | Domain Name for Kubernetes Sysconfig Policy. | `string` | `"example.com"` | no |
| <a name="input_endpoint"></a> [endpoint](#input\_endpoint) | Intersight URL. | `string` | `"https://intersight.com"` | no |
| <a name="input_iks_cluster"></a> [iks\_cluster](#input\_iks\_cluster) | Action to perform on the Intersight Kubernetes Cluster. Options are {Delete\|Deploy\|Ready\|No-op\|Unassign}. | <pre>map(object(<br> {<br> action = optional(string)<br> cluster_moid = string<br> control_plane_desired_size = optional(number)<br> control_plane_intance_moid = string<br> control_plane_max_size = optional(number)<br> control_plane_profile_moid = string<br> ip_pool_moid = string<br> k8s_vm_infra_moid = string<br> load_balancers = optional(number)<br> cluster_name = string<br> network_cidr_moid = string<br> nodeos_cfg_moid = string<br> ssh_key = string<br> ssh_user = string<br> registry_moid = optional(string)<br> runtime_moid = optional(string)<br> tags = optional(list(map(string)))<br> version_moid = string<br> wait_for_complete = optional(bool)<br> worker_desired_size = optional(number)<br> worker_intance_moid = string<br> worker_max_size = optional(number)<br> worker_profile_moid = string<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "action": "Deploy",<br> "cluster_moid": "**REQUIRED**",<br> "cluster_name": "**REQUIRED**",<br> "control_plane_desired_size": 1,<br> "control_plane_intance_moid": "**REQUIRED**",<br> "control_plane_max_size": 3,<br> "control_plane_profile_moid": "**REQUIRED**",<br> "ip_pool_moid": "**REQUIRED**",<br> "k8s_vm_infra_moid": "**REQUIRED**",<br> "load_balancers": 3,<br> "network_cidr_moid": "**REQUIRED**",<br> "nodeos_cfg_moid": "**REQUIRED**",<br> "registry_moid": "",<br> "runtime_moid": "",<br> "ssh_key": "ssh_key_1",<br> "ssh_user": "iksadmin",<br> "tags": [],<br> "version_moid": "**REQUIRED**",<br> "wait_for_complete": false,<br> "worker_desired_size": 0,<br> "worker_intance_moid": "**REQUIRED**",<br> "worker_max_size": 4,<br> "worker_profile_moid": "**REQUIRED**"<br> }<br>}</pre> | no |
| <a name="input_iks_cluster"></a> [iks\_cluster](#input\_iks\_cluster) | Action to perform on the Intersight Kubernetes Cluster. Options are {Delete\|Deploy\|Ready\|No-op\|Unassign}. | <pre>map(object(<br> {<br> action_cluster = optional(string)<br> action_control_plane = optional(string)<br> action_worker = optional(string)<br> action = optional(string)<br> addons = optional(set(string))<br> control_plane_desired_size = optional(number)<br> control_plane_intance_moid = string<br> control_plane_max_size = optional(number)<br> ip_pool_moid = string<br> k8s_vm_infra_moid = string<br> load_balancers = optional(number)<br> ssh_key = string<br> ssh_user = string<br> registry_moid = optional(string)<br> runtime_moid = optional(list(map(string)))<br> tags = optional(list(map(string)))<br> version_moid = string<br> vm_network_moid = string<br> wait_for_complete = optional(bool)<br> worker_desired_size = optional(number)<br> worker_intance_moid = string<br> worker_max_size = optional(number)<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "action_cluster": "Deploy",<br> "action_control_plane": "No-op",<br> "action_worker": "No-op",<br> "addons": [],<br> "control_plane_desired_size": 1,<br> "control_plane_intance_moid": "**REQUIRED**",<br> "control_plane_max_size": 3,<br> "ip_pool_moid": "**REQUIRED**",<br> "k8s_vm_infra_moid": "**REQUIRED**",<br> "load_balancers": 3,<br> "registry_moid": "",<br> "runtime_moid": [],<br> "ssh_key": "ssh_key_1",<br> "ssh_user": "iksadmin",<br> "tags": [],<br> "version_moid": "**REQUIRED**",<br> "vm_network_moid": "**REQUIRED**",<br> "wait_for_complete": false,<br> "worker_desired_size": 0,<br> "worker_intance_moid": "**REQUIRED**",<br> "worker_max_size": 4<br> }<br>}</pre> | no |
| <a name="input_ip_pools"></a> [ip\_pools](#input\_ip\_pools) | * from - host address of the pool starting address. Default is 20<br>* gateway - ip/prefix of the gateway. Default is 198.18.0.1/24<br>* name - Name of the IP Pool. Default is {tenant}\_{cluster\_name}\_ip\_pool.<br>* size - Number of host addresses to assign to the pool. Default is 30. | <pre>map(object(<br> {<br> from = optional(number)<br> gateway = optional(string)<br> name = optional(string)<br> size = optional(number)<br> tags = optional(list(map(string)))<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "from": 20,<br> "gateway": "198.18.0.1/24",<br> "name": "{tenant_name}_ip_pool",<br> "size": 30,<br> "tags": []<br> }<br>}</pre> | no |
| <a name="input_k8s_addons"></a> [k8s\_addons](#input\_k8s\_addons) | List of Add-ons for Intersight Kubernetes Service. Add-ons Options are {ccp-monitor\|kubernetes-dashboard}. | `list(string)` | `[]` | no |
| <a name="input_k8s_addons_name"></a> [k8s\_addons\_name](#input\_k8s\_addons\_name) | Kubernetes Addon Policy Name Prefix. Default name is {tenant\_name}. | `string` | `""` | no |
| <a name="input_k8s_addons"></a> [k8s\_addons](#input\_k8s\_addons) | Map of Add-ons for Intersight Kubernetes Service. Add-ons Options are {ccp-monitor\|kubernetes-dashboard}. | <pre>map(object(<br> {<br> install_strategy = optional(string)<br> name = optional(string)<br> release_name = optional(string)<br> tags = optional(list(map(string)))<br> upgrade_strategy = optional(string)<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "install_strategy": "Always",<br> "name": "{tenant_name}_{addon_key}",<br> "release_name": "",<br> "tags": [],<br> "upgrade_strategy": "UpgradeOnly"<br> }<br>}</pre> | no |
| <a name="input_k8s_runtime"></a> [k8s\_runtime](#input\_k8s\_runtime) | n/a | <pre>map(object(<br> {<br> docker_bridge_cidr = optional(string)<br> docker_no_proxy = optional(list(string))<br> http_hostname = optional(string)<br> http_port = optional(number)<br> http_protocol = optional(string)<br> http_username = optional(string)<br> https_hostname = optional(string)<br> https_port = optional(number)<br> https_protocol = optional(string)<br> https_username = optional(string)<br> name = optional(string)<br> tags = optional(list(map(string)))<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "docker_bridge_cidr": "",<br> "docker_no_proxy": [],<br> "http_hostname": "",<br> "http_port": 8080,<br> "http_protocol": "http",<br> "http_username": "",<br> "https_hostname": "",<br> "https_port": 8443,<br> "https_protocol": "https",<br> "https_username": "",<br> "name": "",<br> "tags": []<br> }<br>}</pre> | no |
| <a name="input_k8s_runtime_create"></a> [k8s\_runtime\_create](#input\_k8s\_runtime\_create) | Flag to specify if the Kubernetes Runtime Policy should be created or not. | `bool` | `false` | no |
| <a name="input_k8s_runtime_http_password"></a> [k8s\_runtime\_http\_password](#input\_k8s\_runtime\_http\_password) | Password for the HTTP Proxy Server, If required. | `string` | `""` | no |
Expand All @@ -253,7 +250,7 @@ No resources.
| <a name="input_k8s_version"></a> [k8s\_version](#input\_k8s\_version) | Kubernetes Version to Deploy. | <pre>map(object(<br> {<br> name = optional(string)<br> tags = optional(list(map(string)))<br> version = optional(string)<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "name": "",<br> "tags": [],<br> "version": "1.19.5"<br> }<br>}</pre> | no |
| <a name="input_k8s_vm_infra"></a> [k8s\_vm\_infra](#input\_k8s\_vm\_infra) | Kubernetes Virtual Machine Infrastructure Configuration Policy. Default name is {tenant\_name}\_vm\_infra. | <pre>map(object(<br> {<br> name = optional(string)<br> tags = optional(list(map(string)))<br> vsphere_cluster = string<br> vsphere_datastore = string<br> vsphere_portgroup = list(string)<br> vsphere_resource_pool = optional(string)<br> vsphere_target = string<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "name": "",<br> "tags": [],<br> "vsphere_cluster": "default",<br> "vsphere_datastore": "datastore1",<br> "vsphere_portgroup": [<br> "VM Network"<br> ],<br> "vsphere_resource_pool": "",<br> "vsphere_target": ""<br> }<br>}</pre> | no |
| <a name="input_k8s_vm_infra_password"></a> [k8s\_vm\_infra\_password](#input\_k8s\_vm\_infra\_password) | vSphere Password. Note: this is the password of the Credentials used to register the vSphere Target. | `string` | n/a | yes |
| <a name="input_k8s_vm_instance"></a> [k8s\_vm\_instance](#input\_k8s\_vm\_instance) | Kubernetes Virtual Machine Instance Policy Variables. Default name is {tenant\_name}\_vm\_network. | <pre>map(object(<br> {<br> large_cpu = optional(number)<br> large_disk = optional(number)<br> large_memory = optional(number)<br> medium_cpu = optional(number)<br> medium_disk = optional(number)<br> medium_memory = optional(number)<br> small_cpu = optional(number)<br> small_disk = optional(number)<br> small_memory = optional(number)<br> tags = optional(list(map(string)))<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "large_cpu": 12,<br> "large_disk": 80,<br> "large_memory": 32768,<br> "medium_cpu": 8,<br> "medium_disk": 60,<br> "medium_memory": 24576,<br> "small_cpu": 4,<br> "small_disk": 40,<br> "small_memory": 16384,<br> "tags": []<br> }<br>}</pre> | no |
| <a name="input_k8s_vm_instance"></a> [k8s\_vm\_instance](#input\_k8s\_vm\_instance) | Kubernetes Virtual Machine Instance Policy Variables. Default name is {tenant\_name}\_vm\_network. | <pre>map(object(<br> {<br> cpu = optional(number)<br> disk = optional(number)<br> memory = optional(number)<br> tags = optional(list(map(string)))<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "cpu": 4,<br> "disk": 40,<br> "memory": 16384,<br> "tags": []<br> }<br>}</pre> | no |
| <a name="input_k8s_vm_network"></a> [k8s\_vm\_network](#input\_k8s\_vm\_network) | Kubernetes Virtual Machine Network Configuration Policy. Default name is {tenant\_name}\_vm\_network. | <pre>map(object(<br> {<br> cidr_pod = optional(string)<br> cidr_service = optional(string)<br> cni = optional(string)<br> name = optional(string)<br> tags = optional(list(map(string)))<br> }<br> ))</pre> | <pre>{<br> "default": {<br> "cidr_pod": "100.64.0.0/16",<br> "cidr_service": "100.65.0.0/16",<br> "cni": "Calico",<br> "name": "",<br> "tags": []<br> }<br>}</pre> | no |
| <a name="input_ntp_servers"></a> [ntp\_servers](#input\_ntp\_servers) | NTP Servers for Kubernetes Sysconfig Policy. | `list(string)` | `[]` | no |
| <a name="input_organization"></a> [organization](#input\_organization) | Intersight Organization Name. | `string` | `"default"` | no |
Expand All @@ -271,7 +268,6 @@ No resources.
| <a name="input_tfc_organization"></a> [tfc\_organization](#input\_tfc\_organization) | Terraform Cloud Organization Name. | `string` | n/a | yes |
| <a name="input_timezone"></a> [timezone](#input\_timezone) | Timezone for Deployment. For a List of supported timezones see the following URL.<br> https://github.com/terraform-cisco-modules/terraform-intersight-imm/blob/master/modules/policies_ntp/README.md. | `string` | `"Etc/GMT"` | no |
| <a name="input_vcs_repo"></a> [vcs\_repo](#input\_vcs\_repo) | Version Control System Repository. | `string` | n/a | yes |
| <a name="input_ws_tenant"></a> [ws\_tenant](#input\_ws\_tenant) | Name of the Tenant Workspace. | `string` | `"default"` | no |

## Outputs

Expand All @@ -281,6 +277,5 @@ No resources.
| <a name="output_iks_workspaces"></a> [iks\_workspaces](#output\_iks\_workspaces) | Terraform Cloud IKS Workspace ID(s). |
| <a name="output_iwo_workspaces"></a> [iwo\_workspaces](#output\_iwo\_workspaces) | Terraform Cloud IWO Workspace ID(s). |
| <a name="output_kube_workspaces"></a> [kube\_workspaces](#output\_kube\_workspaces) | Terraform Cloud Kube Workspace ID(s). |
| <a name="output_tenant_workspace"></a> [tenant\_workspace](#output\_tenant\_workspace) | Terraform Cloud Tenant Workspace ID. |
| <a name="output_tfc_agent_pool"></a> [tfc\_agent\_pool](#output\_tfc\_agent\_pool) | Terraform Cloud Agent Pool ID. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Loading

0 comments on commit 38516e1

Please sign in to comment.