{"id":13451682,"url":"https://github.com/ericchiang/terraform-provider-k8s","last_synced_at":"2025-03-23T19:32:23.179Z","repository":{"id":144205372,"uuid":"120065730","full_name":"ericchiang/terraform-provider-k8s","owner":"ericchiang","description":"Kubernetes Terraform provider with support for raw manifests","archived":true,"fork":false,"pushed_at":"2018-10-12T03:49:06.000Z","size":4167,"stargazers_count":98,"open_issues_count":12,"forks_count":84,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-07-02T14:46:24.765Z","etag":null,"topics":["kubernetes","terraform","terraform-provider"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericchiang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-02-03T06:25:57.000Z","updated_at":"2024-04-21T13:24:40.000Z","dependencies_parsed_at":"2024-01-16T03:46:08.205Z","dependency_job_id":"d59b83bb-0aa9-46bb-8542-02167f8f6d9e","html_url":"https://github.com/ericchiang/terraform-provider-k8s","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fterraform-provider-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fterraform-provider-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fterraform-provider-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fterraform-provider-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericchiang","download_url":"https://codeload.github.com/ericchiang/terraform-provider-k8s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213325064,"owners_count":15570229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubernetes","terraform","terraform-provider"],"created_at":"2024-07-31T07:00:59.025Z","updated_at":"2024-07-31T07:03:58.045Z","avatar_url":"https://github.com/ericchiang.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"This project has been archived and is unmaintained.\n\n# Kubernetes Terraform Provider\n\nThe k8s Terraform provider enables Terraform to deploy Kubernetes resources. Unlike the [official Kubernetes provider][kubernetes-provider] it handles raw manifests, leveraging `kubectl` directly to allow developers to work with any Kubernetes resource natively.\n\n## Usage\n\nUse `go get` to install the provider:\n\n```\ngo get -u github.com/ericchiang/terraform-provider-k8s\n```\n\nRegister the plugin in `~/.terraformrc`:\n\n```hcl\nproviders {\n  k8s = \"/$GOPATH/bin/terraform-provider-k8s\"\n}\n```\n\nThe provider takes the following optional configuration parameters:\n\n* If you have a kubeconfig available on the file system you can configure the provider as:\n\n```hcl\nprovider \"k8s\" {\n  kubeconfig = \"/path/to/kubeconfig\"\n}\n```\n\n* If you content of the kubeconfig is available in a variable, you can configure the provider as:\n\n```hcl\nprovider \"k8s\" {\n  kubeconfig_content = \"${var.kubeconfig}\"\n}\n```\n\n**WARNING:** Configuration from the variable will be recorded into a temporary file and the file will be removed as\nsoon as call is completed. This may impact performance if the code runs on a shared system because\nand the global tempdir is used.\n\nThe k8s Terraform provider introduces a single Terraform resource, a `k8s_manifest`. The resource contains a `content` field, which contains a raw manifest.\n\n```hcl\nvariable \"replicas\" {\n  type    = \"string\"\n  default = 3\n}\n\ndata \"template_file\" \"nginx-deployment\" {\n  template = \"${file(\"manifests/nginx-deployment.yaml\")}\"\n\n  vars {\n    replicas = \"${var.replicas}\"\n  }\n}\n\nresource \"k8s_manifest\" \"nginx-deployment\" {\n  content = \"${data.template_file.nginx-deployment.rendered}\"\n}\n```\n\nIn this case `manifests/nginx-deployment.yaml` is a templated deployment manifest.\n\n```yaml\napiVersion: apps/v1beta2\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: ${replicas}\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.7.9\n        ports:\n        - containerPort: 80\n```\n\nThe Kubernetes resources can then be managed through Terraform.\n\n```terminal\n$ terraform apply\n# ...\nApply complete! Resources: 1 added, 1 changed, 0 destroyed.\n$ kubectl get deployments\nNAME               DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nnginx-deployment   3         3         3            3           1m\n$ terraform apply -var 'replicas=5'\n# ...\nApply complete! Resources: 0 added, 1 changed, 0 destroyed.\n$ kubectl get deployments\nNAME               DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nnginx-deployment   5         5         5            3           3m\n$ terraform destroy -force\n# ...\nDestroy complete! Resources: 2 destroyed.\n$ kubectl get deployments\nNo resources found.\n```\n\n[kubernetes-provider]: https://www.terraform.io/docs/providers/kubernetes/index.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericchiang%2Fterraform-provider-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericchiang%2Fterraform-provider-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericchiang%2Fterraform-provider-k8s/lists"}