34. $ terraform import aws_instance.web i-123456
aws_instance.web: Importing from ID "i-123456"...
aws_instance.web: Import complete!
Imported aws_instance (ID: i-123456)
aws_instance.web: Refreshing state... (ID: i-123456)
Import successful!
The resources that were imported are shown above.
These resources are now in your Terraform state
and will henceforth be managed by Terraform
terraform import
35. “Terraform import의 현재 구현체는 상태로만
리소스를 가져올 수 있습니다. 이는 설정을 만들지
않습니다. Terraform 차기 버전에서는 설정도
생성할 것입니다.
https://www.terraform.io/docs/import/index.html
38. $ terraform import aws_instance.web i-123456
Error: resource address "aws_instance.web" does not
exist in the configuration.
Before importing this resource, please create
its configuration in the root module.
For example:
resource "aws_instance" “web" {
# (resource arguments)
}
terraform import
46. Remote State terraform.tfstate 원격 저장소에서 관리한다
Consul, AWS S3, Google Cloud Storage
(GCS), etcd, Terraform Enterprise 등의
백엔드 지원
상태 파일에는 민감한 정보가 있을 수 있으므로
암호화를 해야 한다
백엔드에 따라 Lock을 사용할 수도 있다