Skip to content

Instantly share code, notes, and snippets.

@githubfoam
Last active February 28, 2022 23:18
Show Gist options
  • Select an option

  • Save githubfoam/89fb406929f03750fc3f31cecc683378 to your computer and use it in GitHub Desktop.

Select an option

Save githubfoam/89fb406929f03750fc3f31cecc683378 to your computer and use it in GitHub Desktop.
terraform cheat sheet
terraform version
terraform init
terraform apply
terraform destroy
terraform fmt -write=false -diff=true provider.tf -> check for styling issues, displaying the diff onscreen, not
writing the files automatically
generate a dependency graph based on the Terraform configuration
$ terraform graph
--------------------------------------------------
# variables.tf
variable "key_name" {
description = "Name of the SSH keypair to use in AWS."
}
variable "aws_region" {
description = "AWS region to launch servers."
default = "eu-west-1"
}
variable "secret_key" {}
----------------------------------------------------------------------------------------------------
#vagrant shared folder issue
$ sudo terraform destroy -auto-approve
kubernetes_pod.nginx: Refreshing state... [id=default/nginx-example]
kubernetes_service.nginx: Refreshing state... [id=default/nginx-example]
Error: fork/exec /vagrant/.terraform/plugins/linux_amd64/terraform-provider-kubernetes_v1.8.1_x4: permission denied
$ sudo lsof | grep terraform
terraform 7114 7115 terraform root txt REG 0,49 47478528 188 /vagrant/app1/.terraform/plugins/linux_amd64/terraform-provider-kubernetes_v1.8.1_x4
$ sudo kill -9 7114
----------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment