Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jkroepke/terraform-provider-azureakscommand
Terraform provider for running commands on private AKS clusters without reach them
https://github.com/jkroepke/terraform-provider-azureakscommand
aks aks-kubernetes-cluster azure kubernetes terraform terraform-provider terraform-provider-azurerm
Last synced: 3 months ago
JSON representation
Terraform provider for running commands on private AKS clusters without reach them
- Host: GitHub
- URL: https://github.com/jkroepke/terraform-provider-azureakscommand
- Owner: jkroepke
- License: mpl-2.0
- Created: 2022-11-01T00:20:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-10T10:41:14.000Z (11 months ago)
- Last Synced: 2024-10-12T23:37:28.524Z (4 months ago)
- Topics: aks, aks-kubernetes-cluster, azure, kubernetes, terraform, terraform-provider, terraform-provider-azurerm
- Language: Go
- Homepage: https://registry.terraform.io/providers/jkroepke/azureakscommand/latest/
- Size: 245 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# terraform-provider-azureakscommand
Terraform provider for running commands on private AKS clusters without reach them
# Examples
## Simple command execution
```terraform
provider "azurerm" {
features {}
}data "azurerm_subscription" "current" {}
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}resource "azurerm_kubernetes_cluster" "example" {
name = "example-aks1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.namedefault_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_D2_v2"
}
}provider "azureakscommand" {
tenant_id = data.azurerm_subscription.current.tenant_id
subscription_id = data.azurerm_subscription.current.subscription_id
}resource "azureakscommand_invoke" "example" {
resource_group_name = azurerm_resource_group.example.name
name = azurerm_kubernetes_cluster.example.namecommand = "kubectl cluster-info"
# Re-run command, if cluster gets recreated.
triggers = {
id = azurerm_kubernetes_cluster.example.id
}# Precondition and Postcondition checks are available with Terraform v1.2.0 and later.
lifecycle {
postcondition {
condition = self.exit_code == 0
error_message = "exit code invalid"
}
}
}output "invoke_output" {
value = azureakscommand_invoke.example.output
}
```## Command execution with additional files
```terraform
provider "azurerm" {
features {}
}data "azurerm_subscription" "current" {}
provider "archive" {}
data "archive_file" "manifests" {
type = "zip"
output_path = "${path.module}/manifests.zip"
source_dir = "${path.module}/manifests/"
}provider "azureakscommand" {
tenant_id = data.azurerm_subscription.current.tenant_id
subscription_id = data.azurerm_subscription.current.subscription_id
}resource "azureakscommand_invoke" "example" {
resource_group_name = "rg-default"
name = "cluster-name"command = "kubectl apply -f manifests/"
context = filebase64(data.archive_file.manifests.output_path)
}
```## Helm
```terraform
provider "azurerm" {
features {}
}data "azurerm_subscription" "current" {}
provider "azureakscommand" {
tenant_id = data.azurerm_subscription.current.tenant_id
subscription_id = data.azurerm_subscription.current.subscription_id
}resource "azureakscommand_invoke" "example" {
resource_group_name = "rg-default"
name = "cluster-name"command = join("&&", [
"helm repo add bitnami https://charts.bitnami.com/bitnami",
"helm repo update",
"helm install my-release --repo bitnami/nginx"
])
}
```