202403

google product

https://www.school.ctc-g.co.jp/columns/nakai2/

borg -> k8s
https://blog.inductor.me/entry/2019/10/30/010839
https://cloudplatform-jp.googleblog.com/2016/08/google-kubernetes.html

omega
https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/41684.pdf

spanner
https://yuichi1004.hatenablog.com/entry/2017/02/26/162204
https://static.googleusercontent.com/media/research.google.com/ja//archive/spanner-osdi2012.pdf

maglev

https://www.school.ctc-g.co.jp/columns/nakai2/

帰仙計画

  • コンセント+RJ45ポート増設
    • 弱電系と強電系を扱う場合は内線規程3102-7を参照のこと
    • コスモワイドシリーズ検討
  • 持ち物系
    • 上記電気工事用品
    • LION, クーラーバッグ, スタバマグ?
    • VPNルータ,交換用SSD
    • 証明写真印刷準備
  • 持ち帰りたい系
    • 真空ポンプ

配下のtgz をディレクトリを作って全部extractする

  • find . -name '*.tgz' | sed -e "s/\.[^.]*$//" | xargs -S1024 -I _ sh -c 'mkdir -p _; tar -xvzf _.tgz -C _; rm _.tgz'

golangで「assignment to entry in nil map」というエラーが出たときの原因と対処法|webdrawer

tfstateの移行

  • aws s3からgoogle cloud storageにうつしたいとか,bucketを変更したいとかもこれと同様にlocalに一旦持ってきてからbackendを切り替えることで実施できる.
## GCSからLocalにもってくる
# backupをとる(optional)
$ terraform state pull >> terraform.tfstate.backup

# ======
# terraform {
# #  backend "gcs" {
# #    bucket = "dev-tfstate"
# #  }
# ...
# }
# ======

# bucketセクションをコメントアウトしてplanを実行すると怒られる.initが必要.
$ terraform plan
 ╷
 │ Error: Backend initialization required, please run "terraform init"
 │
 │ Reason: Unsetting the previously set backend "gcs"
 │
 │ The "backend" is the interface that Terraform uses to store state,
 │ perform operations, etc. If this message is showing up, it means that the
 │ Terraform configuration you're using is using a custom configuration for
 │ the Terraform backend.
 │
 │ Changes to backend configurations require reinitialization. This allows
 │ Terraform to set up the new configuration, copy existing state, etc. Please run
 │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags to
 │ use the current configuration.
 │
 │ If the change reason above is incorrect, please verify your configuration
 │ hasn't changed and try again. At this point, no changes to your existing
 │ configuration or state have been made.

# migrateするためには -migrate-stateオプションが必要と言われる
$ terraform init
 Initializing the backend...
 ╷
 │ Error: Backend configuration changed
 │
 │ A change in the backend configuration has been detected, which may require migrating existing
 │ state.
 │
 │ If you wish to attempt automatic migration of the state, use "terraform init -migrate-state".
 │ If you wish to store the current configuration with no changes to the state, use "terraform
 │ init -reconfigure".
 ╵

# -migrate-state オプションをつけると,gcsからlocalにstate backendを変更する旨の確認が出る.yesでlocalにstateが来る.
$ terraform init -migrate-state

 Initializing the backend...
 Terraform has detected you're unconfiguring your previously set "gcs" backend.
 Do you want to copy existing state to the new backend?
   Pre-existing state was found while migrating the previous "gcs" backend to the
   newly configured "local" backend. No existing state was found in the newly
   configured "local" backend. Do you want to copy this state to the new "local"
   backend? Enter "yes" to copy and "no" to start with an empty state.

   Enter a value: yes

 Successfully unset the backend "gcs". Terraform will now operate locally.

 Initializing provider plugins...
 - Reusing previous version of jp7fkf.dev/dev/dev-terraform-provider from the dependency lock file
 - Using previously-installed jp7fkf.dev/dev/dev-terraform-provider v0.0.1

 Terraform has been successfully initialized!

 You may now begin working with Terraform. Try running "terraform plan" to see
 any changes that are required for your infrastructure. All Terraform commands
 should now work.

 If you ever set or change modules or backend configuration for Terraform,
 rerun this command to reinitialize your working directory. If you forget, other
 commands will detect it and remind you to do so if necessary.

# これでlocalにstate変更が完了


## LocalからGCSにもっていく
# backupとかは省略.概ね逆手順で実行できる.

# backendを記載する.
# ======
# terraform {
#   backend "gcs" {
#     bucket = "dev-tfstate"
#   }
# ...
# }
# ======

# 同様に-migrate-steteを付与してinitをすると,localからgcsにbackendを変更する旨の確認が出る.yesでマイグレ.
$ terraform init -migrate-state
 Initializing the backend...
 Do you want to copy existing state to the new backend?
   Pre-existing state was found while migrating the previous "local" backend to the
   newly configured "gcs" backend. No existing state was found in the newly
   configured "gcs" backend. Do you want to copy this state to the new "gcs"
   backend? Enter "yes" to copy and "no" to start with an empty state.

   Enter a value: yes

 Successfully configured the backend "gcs"! Terraform will automatically
 use this backend unless the backend configuration changes.

 Initializing provider plugins...
 - Reusing previous version of jp7fkf.dev/dev/dev-terraform-provider from the dependency lock file
 - Using previously-installed jp7fkf.dev/dev/dev-terraform-provider v0.0.1

 Terraform has been successfully initialized!

 You may now begin working with Terraform. Try running "terraform plan" to see
 any changes that are required for your infrastructure. All Terraform commands
 should now work.

 If you ever set or change modules or backend configuration for Terraform,
 rerun this command to reinitialize your working directory. If you forget, other
 commands will detect it and remind you to do so if necessary.