๐Ÿ“—
smiley book
  • Smiley Books
  • AI
    • Readme
    • openai-whisper
      • ์ƒ˜ํ”Œ ์‹คํ–‰ํ•ด๋ณด๊ธฐ
      • GPU ์„œ๋ฒ„ ์ค€๋น„ํ•˜๊ธฐ
      • API๋กœ whisper๋ฅผ ์™ธ๋ถ€์— ์˜คํ”ˆํ•˜๊ธฐ
      • ํ”„๋กฌํ”„ํŠธ ์ง€์›
      • ์‹ค์‹œ๊ฐ„ message chat
      • ํ™”๋ฉด ์ด์˜๊ฒŒ ๋งŒ๋“ค๊ธฐ์™€ ๋กœ๊ทธ์ธ
      • ํŒŒ์ด์ฌ ๊ฐ€์ƒํ™˜๊ฒฝ
      • ์‹ค์‹œ๊ฐ„ voice chat
      • fine tunning(๋ฏธ์„ธ ์กฐ์ •) ์œผ๋กœ ์„ฑ๋Šฅ ์˜ฌ๋ฆฌ๊ธฐ
      • app์—์„œ api๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ…์ŠคํŠธ๋กœ ๋ฐ”๊ฟ”๋ณด๊ธฐ
    • ollama - llm์„ ์‰ฝ๊ฒŒ ๋‚ด์ปด์—์„œ ์‹คํ–‰
      • ollama webui
      • ollama docker
    • stable diffusion
      • SDXL - text to image
      • SD-webui
    • ChatGPT
      • ๋‹ต๋ณ€์ด ๋Š๊ธธ๋•Œ
      • ์—ญํ• ์„ ์ •ํ•˜์ž
      • ๊ตฌ์ฒด์ ์ธ ์งˆ๋ฌธ
      • ๊ฒฐ๊ณผํ˜•ํƒœ๋ฅผ ์ง€์ •
      • ํ”„๋กฌํ”„ํŠธ๋ฅผ ์—ฌ๋Ÿฌ์ค„๋กœ ์‚ฌ์šฉํ•˜์ž.
      • ๋งˆํ‹ด ํŒŒ์šธ๋Ÿฌ ๊ธ€ ๋ฒˆ์—ญ๋ณธ
    • Prompt Engineering
    • Auto-GPT
    • Gemini
      • google ai studio
      • gemini-api
      • embedding guide
    • Huggingface
      • huggingface ์‚ฌ์šฉ๋ฒ•
      • huggingface nlp ๊ณต๋ถ€์ค‘
    • kaggle
      • download dataset
    • langchain
      • langchain์„ ๊ณต๋ถ€ํ•˜๋ฉฐ ์ •๋ฆฌ
      • basic
      • slackbot
      • rag
      • document-loader
      • website-loader
      • confluence
      • memory
      • function-call
      • langsmith
      • agent-toolkit
  • Ansible
    • templates vs files and jinja2
    • dynamic inventory
    • limit ์˜ต์…˜ ๊ฐ•์ œํ•˜๊ธฐ
    • limit ์‚ฌ์šฉํ›„ gather_fact ๋ฌธ์ œ
  • AWS
    • AWS CLI
    • EKS
      • cluster manage
      • ALB Controller
      • external-dns
      • fargate
    • ECR
    • S3
    • Certificate Manager
  • Azure
    • Azure AD OAuth Client Flow
  • Container
    • Registry
    • ๋นŒ๋“œ์‹œ์— env๊ฐ’ ์„ค์ •ํ•˜๊ธฐ
  • DB
    • PXC
      • Operator
      • PMM
      • ์‚ญ์ œ
      • GTID
      • Cross Site Replication
    • Mssql
    • Mysql
  • dotnet
    • Thread Pool
    • Connection Pool
    • Thread Pool2
  • Devops
    • Recommendation
  • GIT
    • Basic
    • Submodule
  • GitHub
    • Repository
    • GitHub Action
    • GitHub PR
    • Self Hosted Runner
    • GitHub Webhook
  • GitLab
    • CI/CD
    • CI/CD Advance
    • Ssl renew
    • CI/CD Pass env to other job
  • Go Lang
    • ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๊ตฌ์ถ•
    • multi os binary build
    • kubectl๊ฐ™์€ cli๋งŒ๋“ค๊ธฐ
    • azure ad cli
    • embed static file
    • go study
      • pointer
      • module and package
      • string
      • struct
      • goroutine
  • Kubernetes
    • Kubernetes๋Š” ๋ฌด์—‡์ธ๊ฐ€
    • Tools
    • Install with kubespray
    • Kubernetes hardening guidance
    • 11 ways not to get hacked
    • ArgoCD
      • Install
      • CLI
      • Repository
      • Apps
      • AWS ALB ์‚ฌ์šฉ
      • Notification slack
      • Backup / DR
      • Ingress
      • 2021-11-16 Github error
      • Server Config
      • auth0 ์ธ์ฆ ์ถ”๊ฐ€(oauth,OIDC)
    • Extension
      • Longhorn pvc
      • External dns
      • Ingress nginx
      • Cert Manager
      • Kube prometheus
    • Helm
      • Subchart
      • Tip
    • Loki
    • Persistent Volume
    • TIP
      • Job
      • Pod
      • Log
  • KAFKA
    • raft
  • KVM
    • kvm cpu model
  • Linux
    • DNS Bind9
      • Cert-Manager
      • Certbot
      • Dynamic Update
      • Log
    • Export and variable
    • Grep ์‚ฌ์šฉ๋ฒ•
  • Modeling
    • C4 model introduce
    • Mermaid
    • reference
  • Monitoring
    • Readme
    • 0. What is Monitoring
    • 1. install prometheus and grafana
    • 2. grafana provisioning
    • 3. grafana dashboard
    • 4. grafana portable dashboard
    • 5. prometheus ui
    • 6. prometheus oauth2
    • Prometheus
      • Metric type
      • basic
      • rate vs irate
      • k8s-prometheus
    • Grafana
      • Expolorer
    • Node Exporter
      • advance
      • textfile collector
  • Motivation
    • 3 Simple Rule
  • OPENNEBULA
    • Install(ansible)
    • Install
    • Tip
    • Windows vm
  • Reading
    • comfort zone
    • ๋ฐฐ๋ ค
    • elon musk 6 rule for insane productivity
    • Feynman Technique
    • how to interview - elon musk
    • ๊ฒฝ์ฒญ
    • Readme
  • Redis
    • Install
    • Master-slave Architecture
    • Sentinel
    • Redis Cluster
    • Client programming c#
  • SEO
    • Readme
  • Security
    • criminalip.io
      • criminalip.io
  • Stock
    • robinhood-python
  • Terraform
    • moved block
    • output
  • vault
    • Readme
  • VS Code
    • dev container
    • dev container on remote server
  • Old fashione trend
    • curity
    • MAAS
      • Install maas
      • Manage maas
      • Tip
Powered by GitBook
On this page
  • ํ˜„์žฌ ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์กฐ
  • ๋ชจ๋“ˆ๋กœ ๋ฐ”๊ฟ”๋ณด์ž
  • terraform state mv
  • moved block
  • remote module
  • tfautomv
  • todo

Was this helpful?

  1. Terraform

moved block

Previousrobinhood-pythonNextoutput

Last updated 1 year ago

Was this helpful?

๋ฆฌํŒฉํ† ๋ง ํ• ๋•Œ ๊ผญ ํ•„์š”ํ•œ ๊ธฐ๋Šฅ์ด๋‹ค.

๊ธฐ์กด์— ์žˆ๋Š”์ฝ”๋“œ๋ฅผ ๋ชจ๋“ˆ๋กœ ๋ณด๋‚ด๋ณด์ž.

ํ˜„์žฌ ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์กฐ

main.tf

module "instance_nonflex" {
  source           = "oracle-terraform-modules/compute-instance/oci"
  compartment_ocid = var.compartment_id
  # compute instance parameters
  ad_number             = var.instance_ad_number
  instance_count        = var.instance_count
  instance_display_name = var.instance_display_name
  instance_state        = var.instance_state
  shape                 = var.shape
  source_ocid           = var.source_ocid
  source_type           = var.source_type
  ssh_public_keys = var.ssh_public_keys
  public_ip            = var.public_ip
  subnet_ocids         = [local.private_subnet_id]
  primary_vnic_nsg_ids = null
  boot_volume_backup_policy  = var.boot_volume_backup_policy
  block_storage_sizes_in_gbs = var.block_storage_sizes_in_gbs
}
terraform plan
terraform apply --auto-approve
terraform state list
module.instance_nonflex.data.oci_identity_availability_domains.ad
module.instance_nonflex.oci_core_instance.instance[0]
module.instance_nonflex.oci_core_instance.instance[1]
module.instance_nonflex.oci_core_instance.instance[2]
module.instance_nonflex.oci_core_volume.volume[0]
module.instance_nonflex.oci_core_volume.volume[1]
module.instance_nonflex.oci_core_volume.volume[2]
module.instance_nonflex.oci_core_volume_attachment.volume_attachment[0]
module.instance_nonflex.oci_core_volume_attachment.volume_attachment[1]
module.instance_nonflex.oci_core_volume_attachment.volume_attachment[2]

๋ชจ๋“ˆ๋กœ ๋ฐ”๊ฟ”๋ณด์ž

์ด์ œ ๋ชจ๋“ˆ๋กœ ๋ณ€๊ฒฝํ•ด๋ณธ๋‹ค.

ํด๋”๋ฅผ ๋งŒ๋“ค๊ณ  main.tf๋ฅผ ๋งŒ๋“ค๊ณ  ์ฝ”๋“œ๋ฅผ ์ด๋™ํ•œ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ๊ธฐ์กด main์—์„œ ์ด ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•ด๋ณด์ž.

module "instance" {
  compartment_id = var.compartment_id
  source = "./base/instance"
  source_ocid = "ocid1.image.oc1.us-sanjose-1.ga5ohbkd3nwa"
  instance_state = "RUNNING"
  instance_count = 3
  ssh_public_keys = var.ssh_public_keys
}
terraform plan

9๊ฐœ๋ฅผ ์‚ญ์ œํ•˜๊ณ  ๋‹ค์‹œ ๋งŒ๋“ ๋‹ค. ์ด๋Ÿฌ๋ฉด ๋ฌธ์  ๋œ๋‹ค. ์‹คํ–‰์ค‘์ธ ์„œ๋ฒ„๋ฅผ ์—†์• ๋ฒ„๋ฆฌ๊ฒŒ ๋œ๋‹ค.

terraform state mv

terraform state mv module.instance_nonflex.oci_core_instance.instance[0] module.instance.oci_core_instance.instance[0]

์ด๊ฑธ๋กœ ๊ฐ€๋Šฅํ•˜์‹œ๋„ ํ•˜๋‹ค.

moved block

์‚ฌ์‹ค ์ฝ”๋“œ์— ๋„ฃ์–ด์•ผ ์ข‹๊ธฐ๋Š” ํ•˜๋‹ค.

moved {
  from = OLD
  to   = NEW
}

์ด๊ฑธ ์ถ”๊ฐ€ํ•˜์˜€๋‹ค.

moved {
  from = module.instance_nonflex.oci_core_instance.instance
  to =   module.instance.module.instance_nonflex.oci_core_instance.instance
}

moved {
  from = module.instance_nonflex.oci_core_volume.volume
  to =   module.instance.module.instance_nonflex.oci_core_volume.volume
}

moved {
  from = module.instance_nonflex.oci_core_volume_attachment.volume_attachment
  to =   module.instance.module.instance_nonflex.oci_core_volume_attachment.volume_attachment
}
terraform plan

0๊ฐœ๊ฐ€ ๋ฐ”๊ท€๋Š”๊ฒƒ์„ ์•Œ์ˆ˜ ์žˆ๋‹ค.

terraform apply --auto-approve
terraform state list

remote module

๋ฆฌ๋ชจํŠธ ๋ชจ๋“ˆ์—์„œ๋Š” block์ด ์•ˆ๋œ๋‹ค. ๊ผญ ํ™•์ธํ•ด์•ผํ•œ๋‹ค.

terraform state mv #์œผ๋กœ ์ฒ˜๋ฆฌํ•ด์•ผํ•œ๋‹ค.

tfautomv

https://github.com/padok-team/tfautomv

์ž๋™์œผ๋กœ moved block์„ ๋งŒ๋“ค์–ด์ค€๋‹ค.

brew install padok-team/tap/tfautomv
tfautomv

moved ๋ธ”๋ฝ์„ ์ง€์šฐ๊ณ  ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ด๋ณด์ž.

9๊ฐœ๊ฐ€ ์ถ”๊ฐ€๋˜๊ณ  9๊ฐœ๊ฐ€ ์‚ญ์ œ๋œ๋‹ค๊ณ ํ•œ๋‹ค. ์˜ˆ์ƒํ•˜๋˜ ๊ฒฐ๊ณผ์ด๋‹ค.

์ด์ œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ด๋ณด์ž.

tfautomv

moves.tfํŒŒ์ผ์ด ์ƒ์„ฑ๋œ๋‹ค.

์ข‹๋‹ค.

todo

moved๊ฐ€ ๊ณ„์† ์ž‡์–ด์•ผํ•˜๋‚˜?

terraform state mv๋กœ ์ฒ˜๋ฆฌํ•ด๋„ ๋œ๋‹ค.