terraformã®ãã¼ã¸ã§ã³ãä¸ãããã¨ãããããã£ãã®ã§ã¡ã¢ãã¦ãã
terraform 0.9.11ã使ã£ã¦ããããããã¨ã0.10ç³»ããªãªã¼ã¹ãããã®ã§ãã¼ã¸ã§ã³ã¢ããã試ã¿ãã¨ãããããªãããã£ã¦ãã¾ã£ãã®ã§ã¡ã¢ã
tl;dr
terraform init -backend-config=/path/to/config -reconfigure
Â
ä»ã¾ã§terraform 0.9ç³»ã使ã£ã¦ããã¨ãã¯åã«ãã¤ããªãå·®ãæ¿ããã°ããã£ãã®ã ãã0.10ç³»ã«ä¸ãã£ããã¨ã§è¨å®ãã¡ã¤ã«ã®å½¢å¼ãå¤æ´ããããããããããã£ã¦ããªãé¨åã§ããã£ãã¨ããã ããªã®ã ãã©ã
åæ
- providerã¯AWSã§ãAWS accountAä¸ã«ããããæ§ç¯
- backendã¯å¥ã®AWS accountBä¸ã«ããS3 bucketå ã«stateãç½®ãããã«ãã¦ãã
- accountAã¯æ®æ®µã¯STS AssumeRoleã«ããå©ç¨ãã¦ãã¦ãç°å¢å¤æ°ãexportãã¦ããã
- accountBã¯IAM userã§ãããèªè¨¼æ å ±ã¯ my-backend.tf ã«è¨è¿°ãã¦ãã
ããã£ãæé
ã¾ããã¤ããªãå·®ãæ¿ãããããã¯ç°¡åã
次ã«terraform planã試ãã
ãã¼ã¸ã§ã³ã¢ããç´å¾ã®terraform plan
terraform initãããã¨è¨ãããããªãã»ã©ã¨è¨ãã¤ã¤å®è¡ããã
ä½ãèããã«terraform initãã
ã¨ã©ã¼ãçºçããããªãã§ã â¦ï¼
ã¨ããã§ããªãããã£ãã
ã¨ã©ã¼ã§æ¤ç´¢ãã¦èª¿ã¹ããã¨ãã°ããbackendã®èªè¨¼æ å ±ã渡ãã¦ããªããã¨ã«æ°ä»ããããããåããã
ãã®issueãé常ã«åèã«ãªãã
Â
ããã§initã«æåããææ°ã®terraformã®ä¸çã«ãããã¨ãã§ããã
0.10ããã¯providerãpluginåããã .terraform/plugins/ 以ä¸ã«é ç½®ããã¦ãããããããã¼ã¸ã§ã³ç®¡çã§ããããã«ãªããprovider.aws ã«version constraintãè¨è¿°ãããã¨ã§å°æ¥ã®å¤æ´ã§ç ´å£ãããªãããã«ã§ãããå¹³åãªä¸çã訪ããã
ãã¡ãããã®ãã¨terraformèªèº«ã®version constraintãè¨è¿°ããã