Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
    • Helm Chart
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log & Monitor
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Terraform] – Terraform Beginner – Lesson 6: Terraform Import, Tainting Resources, and Debugging

Posted on May 4, 2022October 6, 2022 By nim No Comments on [Terraform] – Terraform Beginner – Lesson 6: Terraform Import, Tainting Resources, and Debugging

Contents

  • 1) Terraform Taint
  • 2) Debugging
  • 3) Terraform Import
    • Difference between terraform import and terraform data

1) Terraform Taint

Khi chúng ta terraform apply thì lỗi.
Bạn thấy là aws_instance.webserver đã được set là taint
terraform taint aws_instance.webserver

Bạn có thể untaint

terraform untaint aws_instance.webserver

2) Debugging

Chúng ta có nhiều levels về log debug

Bạn cũng có thể output debug ra file.

3) Terraform Import

Bạn được tiếp xúc AWS từ lâu
Có nhứng resource A bạn tạo bằng web console
Có những resource B bạn tạo bằng ansible
Và sau đó đọc các bài post của Nimtechnology thì bạn bắt đầu sử dụng terraform.

Vậy câu hỏi làm sao chúng ta có thể bằng các resource A và B vào terraform?

Các đầu tiên ta sử dụng datasource để lấy được data của resource:

Ví dụ mình muốn lấy IP public của 1 VM mà trước đó mình tạo bằng web console

Các thứ 2:

Sử dụng terraform import

Nêu bạn chạy ngay sẽ bị lỗi.
Nó bảo bạn tạo 1 block resource với data rỗng
Bạn tạo file main.tf như ảnh
xong bạn chạy command import.
Khi đó file main.tf đã được fill đầy đủ
Cho dù bạn chạy terraform plam thì nó cũng ko thấy thay đổi gì?

Difference between terraform import and terraform data

Vì terraform data nó chỉ get data và sử dụng cho lần running đó
terraform import ==> từ 1 resource được tạo manual –>Bạn import data vào trong terraformtf.state -> tạo terraform resource.

AWS - Amazon Web Service

Post navigation

Previous Post: [Terraform] – Terraform Beginner – Lesson 5: Terraform Provisioners and creating EC2
Next Post: [Terraform] – Terraform Beginner – Lesson 7: Terraform Modules

More Related Articles

[csi-driver-smb] Providing PVC with type ReadWriteMany base on SMB AWS - Amazon Web Service
[EKS/Terraform] Installing or Provisioning an EKS cluster through Terraform Module. AWS - Amazon Web Service
[Metrics Server] Install metrics-server on Kubernetes. AWS - Amazon Web Service
[AWS] View Windows AMIs that have faster launching enabled AWS - Amazon Web Service
[AWS] Login and get secret/token/credential of ECR AWS - Amazon Web Service
[VPC] The difference between public and private subnets in Amazon VPC? AWS - Amazon Web Service

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Prometheus/Grafana] Install Prometheus and Grafana on ubuntu. March 27, 2023
  • [Kong Gateway] WebSocket connection failed March 26, 2023
  • [Nextcloud] Can’t download files to have a size bigger than 2Gi on NextCloud – RaspBerry March 24, 2023
  • [Datadog] Using DataDog to monitor all services on kubernetes March 19, 2023
  • [Metrics Server] Failed to make webhook authorizer request: the server could not find the requested resource March 17, 2023

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • Golang
    • Jquery & JavaScript
    • Laravel
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
    • Longhorn – Storage
    • MetalLB
    • Vault
    • VictoriaMetrics
  • Log & Monitor
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2023 NimTechnology.