{"id":3185,"date":"2025-12-12T15:30:59","date_gmt":"2025-12-12T06:30:59","guid":{"rendered":"https:\/\/www.agile-software.site\/?p=3185"},"modified":"2025-12-16T10:47:49","modified_gmt":"2025-12-16T01:47:49","slug":"%f0%9f%93%98-%e6%94%b9%e8%a8%82%e7%89%88%ef%bc%9asnowflake%e3%81%a8terraform%e3%81%ab%e3%82%88%e3%82%8b%e3%82%a4%e3%83%b3%e3%83%95%e3%83%a9%e3%82%b9%e3%83%88%e3%83%a9%e3%82%af%e3%83%81%e3%83%a3","status":"publish","type":"post","link":"https:\/\/agile-software.net\/?p=3185","title":{"rendered":"&#x1f4d8; \u6539\u8a02\u7248\uff1aSnowflake\u3068Terraform\u306b\u3088\u308b\u30a4\u30f3\u30d5\u30e9\u30b9\u30c8\u30e9\u30af\u30c1\u30e3\u30fb\u30a2\u30ba\u30fb\u30b3\u30fc\u30c9\uff08IaC\uff09\u5b9f\u8df5\u30ac\u30a4\u30c9"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u25c9 \u672c\u66f8\u306e\u76ee\u7684<\/h3>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u3001\u30ed\u30fc\u30eb\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3001\u30b9\u30ad\u30fc\u30de\u3092\u306f\u3058\u3081\u3068\u3059\u308b<strong>Snowflake\u306e\u30ea\u30bd\u30fc\u30b9<\/strong>\u3092 Terraform\u3067\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>IaC (Infrastructure as Code)<\/strong> \u30c4\u30fc\u30eb\u3067\u3042\u308b Terraform \u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30ea\u30bd\u30fc\u30b9\u7ba1\u7406\u306b\u304a\u3051\u308b\u300c\u8996\u8a8d\u6027\u300d\u300c\u518d\u5229\u7528\u6027\u300d\u300c\u76e3\u67fb\u53ef\u80fd\u6027\u300d<strong>\u304c\u98db\u8e8d\u7684\u306b\u5411\u4e0a\u3057\u307e\u3059\u3002Snowflake\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u306e\u624b\u52d5 SQL \u5b9f\u884c\u3068\u7570\u306a\u308a\u3001\u30ea\u30bd\u30fc\u30b9\u306e\u5b9a\u7fa9\u3092\u30b3\u30fc\u30c9\u3068\u3057\u3066\u4e00\u5143\u7ba1\u7406\u3057\u3001Git\uff08GitHub\u306a\u3069\uff09\u3067\u5909\u66f4\u5c65\u6b74\u3092\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3067\u304d\u308b\u70b9\u306b\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002\u7279\u306b\u8907\u6570\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u6a2a\u65ad\u7684\u306b\u958b\u767a\u3059\u308b\u73fe\u5834\u3067\u306f\u3001\u65e2\u5b58\u30b3\u30fc\u30c9\u306e\u4f7f\u3044\u56de\u3057\u306b\u3088\u308b<\/strong>\u5727\u5012\u7684\u306a\u958b\u767a\u52b9\u7387\u306e\u5411\u4e0a\u304c\u671f\u5f85\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 \u5bfe\u8c61\u3068\u3059\u308b\u8aad\u8005<\/h3>\n\n\n\n<p>\u672c\u66f8\u306f\u3001Snowflake\u3092\u30c7\u30fc\u30bf\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3068\u3057\u3066\u5229\u7528\u3057\u3066\u3044\u308b\u300c\u30c7\u30fc\u30bf\u30a8\u30f3\u30b8\u30cb\u30a2\u300d\u3084\u300c\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u30a8\u30f3\u30b8\u30cb\u30a2\u300d\u3092\u8aad\u8005\u306e\u5bfe\u8c61\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u300c\u30c7\u30fc\u30bf\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\u3068\u3057\u3066\u306e Snowflake \u306e\u5229\u70b9\u306f\u7406\u89e3\u3057\u3066\u3044\u308b\u304c\u3001\u69cb\u6210\u306e\u7ba1\u7406\u65b9\u6cd5\u304c\u308f\u304b\u3089\u306a\u3044\u300d<\/strong><\/li>\n\n\n\n<li><strong>\u300c\u30c7\u30fc\u30bf\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\u306e\u5909\u66f4\u3092\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e CI\/CD \u306e\u8a2d\u5b9a\u65b9\u6cd5\u3067\u60a9\u3093\u3067\u3044\u308b\u300d<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u3068\u3044\u3063\u305f\u8ab2\u984c\u3092\u6301\u3064\u65b9\u304c\u3001\u73fe\u4ee3\u306e\u30c7\u30fc\u30bf\u958b\u767a\u306b\u304a\u3051\u308b\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u53c2\u8003\u306b\u3067\u304d\u308b\u5185\u5bb9\u3092\u57f7\u7b46\u3057\u3066\u3044\u307e\u3059\u3002\u672c\u66f8\u3092\u8aad\u307f\u9032\u3081\u308b\u4e0a\u3067\u3001Snowflake\u306e\u57fa\u790e\u7684\u306a\u77e5\u8b58\u304c\u3042\u308b\u3068\u3088\u308a\u6df1\u3044\u7406\u89e3\u306b\u7e4b\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 \u53d6\u308a\u6271\u3046\u5185\u5bb9<\/h3>\n\n\n\n<p>\u672c\u66f8\u3067\u6271\u3046\u4e3b\u306a\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Terraform \u00d7 Snowflake<\/strong><\/li>\n\n\n\n<li><strong>GitHub Actions<\/strong> \u3092\u7528\u3044\u305f CI\/CD<\/li>\n\n\n\n<li><strong>Schema Migration Tool<\/strong> (Flyway, Liquibase\u306a\u3069)<\/li>\n<\/ul>\n\n\n\n<p>\u672c\u66f8\u306e\u30bf\u30a4\u30c8\u30eb\u306e\u901a\u308a\u3001Snowflake\u306e<strong>\u30ea\u30bd\u30fc\u30b9<\/strong>\u7ba1\u7406\u306f Terraform \u3067\u5b9f\u884c\u3057\u307e\u3059\u3002\u5b9f\u969b\u306e\u73fe\u5834\u306e\u3088\u3046\u306a\u30c1\u30fc\u30e0\u958b\u767a\u3092\u524d\u63d0\u3068\u3057\u3066\u3001Terraform \u306e\u5b9f\u884c\u306b\u306f <strong>GitHub Actions<\/strong> \u3092\u4f7f\u7528\u3057\u3001IaC \u306e\u30c7\u30d7\u30ed\u30a4\u30e1\u30f3\u30c8\u3092\u4e00\u7b87\u6240\u3067\u7ba1\u7406\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u3001Snowflake\u306e\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u3084\u30b9\u30ad\u30fc\u30de\u69cb\u9020\u306e\u5909\u66f4\uff08\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\uff09<strong>\u306b\u306f\u3001\u3082\u306f\u3084\u4e3b\u6d41\u3068\u306a\u3063\u305f dbt (Data Build Tool) \u3084\u3001\u5c02\u9580\u306e<\/strong>\u30b9\u30ad\u30fc\u30de\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30eb\uff08Flyway, Liquibase\u306a\u3069\uff09\u306e\u6d3b\u7528\u306b\u7126\u70b9\u3092\u5f53\u3066\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u672c\u66f8\u306b\u63b2\u8f09\u3059\u308b\u60c5\u5831\u3092\u3082\u3068\u306b\u3001\u300cSnowflake \u00d7 Terraform\u300d\u3092\u4f7f\u3063\u305f\u3001<strong>\u5805\u7262\u3067\u52b9\u7387\u7684\u306a\u958b\u767a<\/strong>\u306b\u305c\u3072\u53d6\u308a\u7d44\u3093\u3067\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">&#x1f680; \u6280\u8853\u89e3\u8aac\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 Snowflake\u3068\u306f\uff08\u6700\u65b0\u306e\u8996\u70b9\uff09<\/h3>\n\n\n\n<p>Snowflake\u3068\u306f\u3001\u4e00\u8a00\u306b\u3059\u308c\u3070\u30af\u30e9\u30a6\u30c9\u578b\u306e\u30c7\u30fc\u30bf\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9(DWH)\u3067\u3059\u3002\u5f93\u6765\u306e DWH \u3068\u306e\u6700\u5927\u306e\u9055\u3044\u306f\u3001\u30b9\u30c8\u30ec\u30fc\u30b8\uff08\u30c7\u30fc\u30bf\u30ea\u30bd\u30fc\u30b9\uff09<strong>\u3068<\/strong>\u30b3\u30f3\u30d4\u30e5\u30fc\u30c8\uff08\u51e6\u7406\u30ea\u30bd\u30fc\u30b9\uff09\u304c\u5b8c\u5168\u306b\u5206\u96e2\u3057\u3001\u72ec\u7acb\u3057\u3066\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u3067\u304d\u308b\u70b9\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7279\u5fb4\u7684\u306a\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3:<\/strong> \u300c\u30de\u30eb\u30c1\u30af\u30e9\u30b9\u30bf\u30fc\u3001\u5171\u6709\u30c7\u30fc\u30bf\u300d\u3092\u30ad\u30fc\u30ef\u30fc\u30c9\u3068\u3057\u3001\u30c7\u30fc\u30bf\u306f\u4e00\u7b87\u6240\uff08\u30af\u30e9\u30a6\u30c9\u30b9\u30c8\u30ec\u30fc\u30b8\uff09\u306b\u4fdd\u5b58\u3055\u308c\u3001\u51e6\u7406\u306f\u8907\u6570\u306e\u72ec\u7acb\u3057\u305f\u4eee\u60f3\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\uff08\u30af\u30e9\u30b9\u30bf\u30fc\uff09\u306b\u3088\u3063\u3066\u8d85\u9ad8\u901f\u3067\u4e26\u5217\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30b3\u30b9\u30c8\u52b9\u7387\u3068\u67d4\u8edf\u6027:<\/strong> \u30b3\u30f3\u30d4\u30e5\u30fc\u30c8\u30ea\u30bd\u30fc\u30b9\u3092\u4f7f\u308f\u306a\u3044\u30a2\u30a4\u30c9\u30eb\u6642\u306b\u306f\u8ab2\u91d1\u304c\u767a\u751f\u3057\u306a\u3044\u305f\u3081\u3001\u30b3\u30b9\u30c8\u52b9\u7387\u306b\u512a\u308c\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30c7\u30fc\u30bf\u30af\u30e9\u30a6\u30c9\u3078\u306e\u9032\u5316:<\/strong> \u73fe\u5728\u3001Snowflake\u306f DWH \u3068\u3044\u3046\u67a0\u3092\u8d85\u3048\u3001\u30c7\u30fc\u30bf\u5171\u6709\uff08Data Sharing\uff09\u3001\u5916\u90e8\u30c7\u30fc\u30bf\u3078\u306e\u30a2\u30af\u30bb\u30b9\uff08External Tables\uff09\u3001\u305d\u3057\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\uff08Streamlit\/Snowflake Native Apps\uff09\u3092\u53ef\u80fd\u306b\u3059\u308b<strong>\u30c7\u30fc\u30bf\u30af\u30e9\u30a6\u30c9<\/strong>\u3078\u3068\u9032\u5316\u3057\u3066\u3044\u307e\u3059\u3002<strong>Zero Copy Clone<\/strong> \u3084 <strong>Time Travel<\/strong> \u306f\u305d\u306e\u6838\u3068\u306a\u308b\u6a5f\u80fd\u3067\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 Terraform\u3068\u306f<\/h3>\n\n\n\n<p>Terraform \u306f\u3001<strong>Infrastructure as Code (IaC)<\/strong> \u306e\u4ee3\u8868\u7684\u306a\u30c4\u30fc\u30eb\u3067\u3042\u308a\u3001AWS, Azure \u306a\u3069\u306e\u30af\u30e9\u30a6\u30c9\u30b5\u30fc\u30d3\u30b9\u4e0a\u306e\u30a4\u30f3\u30d5\u30e9\u30ea\u30bd\u30fc\u30b9\u3092\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5b9a\u7fa9\u30fb\u69cb\u7bc9\u307e\u3067\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30e1\u30ea\u30c3\u30c8:<\/strong> \u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u3067\u306e\u624b\u52d5\u64cd\u4f5c\u3088\u308a\u3082\u3001\u7d20\u65e9\u304f\u3001<strong>\u30df\u30b9\u304c\u306a\u304f<\/strong>\u3001<strong>\u518d\u73fe\u6027\u9ad8\u304f<\/strong>\u69cb\u7bc9\u304c\u53ef\u80fd\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u5bfe\u5fdc\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc:<\/strong> AWS\u3001Azure \u306a\u3069\u306e\u5404\u7a2e\u30af\u30e9\u30a6\u30c9\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u306b\u52a0\u3048\u3001\u672c\u66f8\u3067\u5bfe\u8c61\u3068\u3059\u308b Snowflake \u306e\u30ea\u30bd\u30fc\u30b9\uff08\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3001\u30e6\u30fc\u30b6\u30fc\u3001\u30ed\u30fc\u30eb\u306a\u3069\uff09\u3082\u3001<strong>Snowflake Provider<\/strong> \u3092\u4f7f\u3063\u3066\u30b3\u30fc\u30c9\u3068\u3057\u3066\u7ba1\u7406\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">&#x1f6e0;&#xfe0f; \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u57fa\u672c\u30b3\u30de\u30f3\u30c9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 Install\u306e\u65b9\u6cd5\uff08Homebrew\uff09<\/h3>\n\n\n\n<p>MacOS \u306e Homebrew \u3092\u4f7f\u3063\u305f Terraform \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>$ brew tap hashicorp\/tap\n$ brew install hashicorp\/tap\/terraform<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 Install\u306e\u78ba\u8a8d<\/h3>\n\n\n\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001<code>terraform -help<\/code> \u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>$ terraform -help\nUsage: terraform [global options] &lt;subcommand&gt; [args]\n# ... \u7701\u7565 ...<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 \u57fa\u672c\u30b3\u30de\u30f3\u30c9\uff08\u5909\u66f4\u306a\u3057\uff09<\/h3>\n\n\n\n<p>\u6700\u4f4e\u9650\u899a\u3048\u3066\u304a\u304f\u3079\u304d\u57fa\u672c\u30b3\u30de\u30f3\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>\u30b3\u30de\u30f3\u30c9<\/strong><\/td><td><strong>\u5f79\u5272<\/strong><\/td><\/tr><\/thead><tbody><tr><td><code>init<\/code><\/td><td>\u30ef\u30fc\u30ad\u30f3\u30b0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u521d\u671f\u6e96\u5099\u3001\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/td><\/tr><tr><td><code>validate<\/code><\/td><td>\u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u306e\u69cb\u6587\u304a\u3088\u3073\u57fa\u672c\u8a2d\u5b9a\u306e\u59a5\u5f53\u6027\u30c1\u30a7\u30c3\u30af\u3002<\/td><\/tr><tr><td><code>plan<\/code><\/td><td>\u69cb\u6210\u306e\u5b9f\u884c\u8a08\u753b\uff08\u8ffd\u52a0\u30fb\u66f4\u65b0\u30fb\u524a\u9664\uff09\u306e\u78ba\u8a8d\u3002<strong>\u5b9f\u969b\u306e\u30ea\u30bd\u30fc\u30b9\u306b\u306f\u53cd\u6620\u3055\u308c\u306a\u3044\u3002<\/strong><\/td><\/tr><tr><td><code>apply<\/code><\/td><td>\u5b9f\u884c\u8a08\u753b\u306b\u57fa\u3065\u304d\u3001\u5b9f\u969b\u306e\u30ea\u30bd\u30fc\u30b9\u306e\u8ffd\u52a0\u30fb\u66f4\u65b0\u30fb\u524a\u9664\u3092\u5b9f\u884c\u3002<\/td><\/tr><tr><td><code>destroy<\/code><\/td><td>\u4f5c\u6210\u3057\u305f\u30a4\u30f3\u30d5\u30e9\u306e\u524a\u9664\u3002<strong>\u5b9f\u884c\u6642\u306b\u306f\u6700\u5927\u9650\u306e\u6ce8\u610f\u304c\u5fc5\u8981\u3002<\/strong><\/td><\/tr><tr><td><code>fmt<\/code><\/td><td>\u30b3\u30fc\u30c9\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u6574\u5f62\u3057\u3001\u4e00\u8cab\u6027\u3092\u4fdd\u3064\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">&#x1f4d0; \u30ea\u30bd\u30fc\u30b9\u5b9a\u7fa9\u306e\u4f8b\uff08\u5909\u66f4\u306a\u3057\uff09<\/h2>\n\n\n\n<p>Terraform \u3067\u306f\u3001<code>.tf<\/code> \u62e1\u5f35\u5b50\u3092\u6301\u3064\u30d5\u30a1\u30a4\u30eb\u306b\u30ea\u30bd\u30fc\u30b9\u5b9a\u7fa9\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30bd\u30fc\u30b9\u306e\u5b9a\u7fa9\u3068\u3001\u305d\u308c\u306b\u5bfe\u3059\u308b\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b\u305f\u3081\u306e <code>grant<\/code> \u304c\u57fa\u672c\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u3001\u30ed\u30fc\u30eb\u3001\u30ed\u30fc\u30eb\u968e\u5c64\u306e\u4f5c\u6210\u4f8b\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>resource &quot;snowflake_user&quot; &quot;user1&quot; {\n  name    = &quot;user1&quot;\n  comment = &quot;example user&quot;\n}\n\nresource &quot;snowflake_role&quot; &quot;parent&quot; {\n  name    = &quot;parent_role&quot;\n  comment = &quot;example role&quot;\n}\n\nresource &quot;snowflake_role&quot; &quot;child&quot; {\n  name    = &quot;child_role&quot;\n  comment = &quot;example role&quot;\n}\n\nresource &quot;snowflake_role_grants&quot; &quot;grants&quot; {\n  role_name = snowflake_role.child.name\n\n  # child\u30ed\u30fc\u30eb\u306bparent\u30ed\u30fc\u30eb\u3092\u4ed8\u4e0e\u3057\u3001\u30ed\u30fc\u30eb\u306e\u968e\u5c64\u95a2\u4fc2\u3092\u69cb\u7bc9\n  roles = [\n    snowflake_role.parent.name,\n  ]\n  \n  # user1\u306bchild\u30ed\u30fc\u30eb\u3092\u4ed8\u4e0e\n  users = [\n    snowflake_user.user1.name\n  ]\n}<\/code><\/pre><\/div>\n\n\n\n<p>\u25c9Snowflake \u30c8\u30e9\u30a4\u30a2\u30eb\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u4f5c\u6210<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u30ea\u30f3\u30af\u304b\u3089Snowflake\u306e\u30c8\u30e9\u30a4\u30a2\u30eb\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u4f5c\u6210\u3092\u884c\u3044\u307e\u3057\u3087\u3046\u3002\u3059\u3067\u306bSnowflake\u3092\u767b\u9332\u6e08\u307f\u3067\u5229\u7528\u53ef\u80fd\u306a\u65b9\u306f\u30b9\u30ad\u30c3\u30d7\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u25c9Snowflake\u3078\u306e\u30ed\u30b0\u30a4\u30f3\u3092\u5b8c\u4e86\u3059\u308b<\/p>\n\n\n\n<p>\u30a2\u30ab\u30a6\u30f3\u30c8\u304c\u4f5c\u6210\u3067\u304d\u3066\u3001\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306bSnowflake\u306e\u753b\u9762\u306b\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308c\u3070\u6e96\u5099\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u25c9Snowflake\u306e\u6e96\u5099<\/p>\n\n\n\n<p>Snowflake\u3067Terraform\u7528\u306b\u4f7f\u7528\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u3068\u30ed\u30fc\u30eb\u3068\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\u306e\u6e96\u5099\u3092\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">&#x1f6e0;&#xfe0f; \u6539\u8a02\u7248\uff1aSnowflake IaC\u74b0\u5883\u69cb\u7bc9\u3068CI\/CD\u5b9f\u8df5\u30ac\u30a4\u30c9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 Snowflake\u306e\u6e96\u5099\uff08\u6700\u65b0\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u63a8\u5968\u4e8b\u9805\uff09<\/h3>\n\n\n\n<p>Terraform \u3067\u4f7f\u7528\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u3001\u30ed\u30fc\u30eb\u3001\u304a\u3088\u3073\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\u306e\u6e96\u5099\u306b\u95a2\u3059\u308b SQL \u3092\u66f4\u65b0\u3057\u3001<strong>\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3067\u306f\u306a\u304f\u3001\u3088\u308a\u30bb\u30ad\u30e5\u30a2\u306a\u30ad\u30fc\u30da\u30a2\u8a8d\u8a3c<\/strong>\u306e\u5c0e\u5165\u3092\u63a8\u5968\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>-- 1. \u5c02\u7528\u30ed\u30fc\u30eb\u306e\u4f5c\u6210 (\u6700\u5c0f\u6a29\u9650\u306e\u539f\u5247\u306b\u57fa\u3065\u304d\u3001\u5fc5\u8981\u306a\u6a29\u9650\u306e\u307f\u3092\u4ed8\u4e0e)\nCREATE ROLE IF NOT EXISTS TERRAFORM_CI_ROLE COMMENT = &#39;Role for Terraform CI\/CD automation.&#39;;\n\n-- 2. \u30b5\u30fc\u30d3\u30b9\u30a2\u30ab\u30a6\u30f3\u30c8\u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210 (\u30ad\u30fc\u30da\u30a2\u8a8d\u8a3c\u3092\u63a8\u5968)\n-- \u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306e\u4f8b\uff08\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30ea\u30b9\u30af\u304c\u9ad8\u3044\u305f\u3081\u975e\u63a8\u5968\uff09\nCREATE USER IF NOT EXISTS TERRAFORM_CI_USER\n    PASSWORD = &#39;TemporaryPassword123!&#39; -- \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306e\u305f\u3081\u3001\u5fc5\u305a\u8907\u96d1\u306a\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u5909\u66f4\n    DEFAULT_ROLE = TERRAFORM_CI_ROLE\n    DEFAULT_WAREHOUSE = TERRAFORM_WH\n    MUST_CHANGE_PASSWORD = TRUE;\n\n-- 3. \u5fc5\u8981\u306a\u7ba1\u7406\u6a29\u9650\u306e\u4ed8\u4e0e (\u6700\u5c0f\u6a29\u9650\u306e\u539f\u5247\u306b\u57fa\u3065\u304d\u3001SECURITYADMIN\u3068SYSADMIN\u306e\u76f4\u63a5\u4ed8\u4e0e\u306f\u975e\u63a8\u5968)\n-- \u30e6\u30fc\u30b6\u30fc\u3084\u30ed\u30fc\u30eb\u7ba1\u7406\u306b\u306f USERADMIN \u307e\u305f\u306f SECURITYADMIN \u306e\u307f\u304c\u671b\u307e\u3057\u3044\nGRANT ROLE USERADMIN TO ROLE TERRAFORM_CI_ROLE;\nGRANT ROLE SYSADMIN TO ROLE TERRAFORM_CI_ROLE; -- \u30ea\u30bd\u30fc\u30b9\u4f5c\u6210\u306e\u305f\u3081\u306b\u4e00\u6642\u7684\u306bSYSADMIN\u3092\u4ed8\u4e0e\n\n-- 4. \u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\u306e\u4f5c\u6210\u3068\u8a2d\u5b9a\uff08\u6700\u65b0\u306e\u63a8\u5968\u8a2d\u5b9a\uff09\nCREATE OR REPLACE WAREHOUSE TERRAFORM_WH \n    WAREHOUSE_SIZE = XSMALL\n    AUTO_RESUME = TRUE\n    AUTO_SUSPEND = 300 -- 5\u5206\u9593\uff08\u30b3\u30b9\u30c8\u524a\u6e1b\u306e\u305f\u3081\u77ed\u3081\u306b\u8a2d\u5b9a\uff09\n    INITIALLY_SUSPENDED = TRUE\n    STATEMENT_TIMEOUT_IN_SECONDS = 3600 -- 60\u5206\n    COMMENT = &#39;For Terraform CI\/CD operations.&#39;;\n\n-- 5. \u6a29\u9650\u4ed8\u4e0e\n-- \u4f5c\u6210\u3057\u305fCI\/CD\u7528\u30ed\u30fc\u30eb\u306b\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\u306e\u4f7f\u7528\u6a29\u9650\u3092\u4ed8\u4e0e\nGRANT USAGE ON WAREHOUSE TERRAFORM_WH TO ROLE TERRAFORM_CI_ROLE;\n\n-- \u88dc\u8db3: \u8907\u6570\u306e\u30ed\u30fc\u30eb\u306b\u540c\u3058\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b\u969b\u306f\u3001\u500b\u5225\u306bGRANT\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\nGRANT USAGE ON WAREHOUSE TERRAFORM_WH TO ROLE SECURITYADMIN;<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 \u74b0\u5883\u5909\u6570\u306e\u6e96\u5099\uff08\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f37\u5316\uff09<\/h3>\n\n\n\n<p>Terraform \u306e\u5b9f\u884c\u74b0\u5883\u5909\u6570\u3092\u3001\u3088\u308a\u30bb\u30ad\u30e5\u30a2\u306a\u65b9\u5f0f\u306b\u66f4\u65b0\u3057\u307e\u3059\u3002<strong>\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306f\u975e\u63a8\u5968<\/strong>\u3068\u3057\u3001\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\uff08\u79d8\u5bc6\u60c5\u5831\uff09\u306f GitHub Actions \u306e Secrets \u3092\u901a\u3058\u3066\u306e\u307f\u6e21\u3059\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>\u74b0\u5883\u5909\u6570,\u76ee\u7684,\u65e7\u8a2d\u5b9a\u306e\u6ce8\u610f\u70b9,\u6700\u65b0\u306e\u63a8\u5968\nSNOWFLAKE_ACCOUNT,\u30a2\u30ab\u30a6\u30f3\u30c8\u30ed\u30b1\u30fc\u30bf\u30fc,\u5909\u66f4\u306a\u3057,\u5909\u66f4\u306a\u3057\nSNOWFLAKE_USER,\u30e6\u30fc\u30b6\u30fc\u540d,\u5909\u66f4\u306a\u3057,\u5909\u66f4\u306a\u3057\nSNOWFLAKE_PASSWORD,\u30d1\u30b9\u30ef\u30fc\u30c9,\u74b0\u5883\u5909\u6570\u3067\u306f\u306a\u304fGitHub Secrets\u3067\u306e\u307f\u8a2d\u5b9a\u3002\u975e\u63a8\u5968\u3002,\u4f7f\u7528\u3057\u306a\u3044 (SNOWFLAKE_PRIVATE_KEY\u306b\u7f6e\u304d\u63db\u3048\u3092\u63a8\u5968)\nSNOWFLAKE_ROLE,\u4f7f\u7528\u30ed\u30fc\u30eb,\u5909\u66f4\u306a\u3057,\u5909\u66f4\u306a\u3057\nSNOWFLAKE_WAREHOUSE,\u4f7f\u7528\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9,\u5909\u66f4\u306a\u3057,\u5909\u66f4\u306a\u3057<\/code><\/pre><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u30ad\u30fc\u30da\u30a2\u8a8d\u8a3c\u3092\u5c0e\u5165\u3059\u308b\u5834\u5408:<\/strong> <code>SNOWFLAKE_PASSWORD<\/code> \u306e\u4ee3\u308f\u308a\u306b\u3001\u79d8\u5bc6\u9375\u3092 GitHub Secrets \u306b\u683c\u7d0d\u3057\u3001<code>SNOWFLAKE_PRIVATE_KEY<\/code> \u307e\u305f\u306f <code>SNOWFLAKE_PRIVATE_KEY_PATH<\/code> \u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">\u25c9 GitHub Actions\u3067Terraform\u3092\u5b9f\u884c\uff08\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u69cb\u6210\u306e\u73fe\u4ee3\u5316\uff09<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1. AWS\u3067Terraform\u306e\u30b9\u30c6\u30fc\u30c8\u3092\u7ba1\u7406\u3059\u308b<\/h4>\n\n\n\n<p>S3\u3092\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3068\u3057\u3001DynamoDB\u3067\u30b9\u30c6\u30fc\u30c8\u30ed\u30c3\u30af\u3092\u884c\u3046\u65b9\u91dd\u306f\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3068\u3057\u3066\u5f15\u304d\u7d9a\u304d\u6709\u52b9\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Terraform \u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u66f4\u65b0:<\/strong> <code>~> 1.3.0<\/code> \u304b\u3089 <strong>\u6700\u65b0\u5b89\u5b9a\u7248<\/strong> (<code>~> 1.6.0<\/code> \u4ee5\u4e0a) \u306b\u66f4\u65b0\u3092\u63a8\u5968\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong><code>provider.tf<\/code> \u306e\u66f4\u65b0\u4f8b:<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>terraform {\n  required_version = &quot;~&gt; 1.6.0&quot; # \u6700\u65b0\u5b89\u5b9a\u7248\u306b\u66f4\u65b0\n\n  backend &quot;s3&quot; {\n    bucket         = &quot;terraform-state-mnagaa&quot;\n    region         = &quot;ap-northeast-1&quot;\n    key            = &quot;common-github.tfstate&quot;\n    dynamodb_table = &quot;mnagaa-terraform-state-lock&quot;\n    # OIDC\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001profile\u3084access key\u306e\u8a18\u8f09\u306f\u4e0d\u8981\u306b\u306a\u308b\n  }\n  \n  required_providers {\n    aws = {\n      source  = &quot;hashicorp\/aws&quot;\n      version = &quot;~&gt; 5.0&quot; # \u6700\u65b0\u306e\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u66f4\u65b0\n    }\n    # Snowflake Provider\u306e\u30bd\u30fc\u30b9\u3092\u660e\u8a18\n    snowflake = {\n      source  = &quot;Snowflake-Labs\/snowflake&quot;\n      version = &quot;~&gt; 0.89.0&quot; # \u6700\u65b0\u5b89\u5b9a\u7248\u306b\u66f4\u65b0\n    }\n  }\n}\n\nprovider &quot;aws&quot; {\n  region = &quot;ap-northeast-1&quot;\n  # OIDC\u3092\u4f7f\u3046\u305f\u3081\u3001\u30af\u30ec\u30c7\u30f3\u30b7\u30e3\u30eb\u8a2d\u5b9a\u306fGitHub Actions\u5074\u3067\u884c\u3046\n  default_tags {\n    tags = {\n      env     = var.environment\n      project = var.project\n      owner   = &quot;terraform&quot;\n      tfstate = &quot;common-github&quot;\n    }\n  }\n}<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">2. OIDC\u3092\u4f7f\u3063\u305fAWS\u3068GitHub Actions\u306e\u9023\u643a\uff08\u6700\u65b0\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\uff09<\/h4>\n\n\n\n<p>OIDC\uff08OpenID Connect\uff09\u3092\u4f7f\u3063\u305f AWS \u3068\u306e\u9023\u643a\u306f\u3001\u6700\u3082\u30bb\u30ad\u30e5\u30a2\u3067\u63a8\u5968\u3055\u308c\u308b\u65b9\u6cd5\u3067\u3059\u3002<strong>GitHub Actions \u3067\u306e OIDC \u8a2d\u5b9a\u306f\u3001Terraform \u3067\u7ba1\u7406\u3059\u308b\u3053\u3068\u304c\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3067\u3059\u3002<\/strong><\/p>\n\n\n\n<p><strong><code>aws_iam_openid_connect_provider<\/code> <\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. Terraform Plan\u3092\u5b9f\u884c\u3059\u308b\u30ef\u30fc\u30af\u30d5\u30ed\u30fc (<code>tf-plan.yml<\/code> \u306e\u73fe\u4ee3\u5316)<\/h4>\n\n\n\n<p>GitHub Actions \u306e\u69cb\u6587\u3068\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u5f37\u5316\u3057\u3001\u6700\u65b0\u306e <code>setup-terraform<\/code> \u30a2\u30af\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>uses: actions\/checkout@v3<\/code> \u2192 <code>@v4<\/code> \u4ee5\u4e0a\u3078\u66f4\u65b0<\/strong><\/li>\n\n\n\n<li><strong><code>aws-actions\/configure-aws-credentials@master<\/code> \u2192 <code>@v4<\/code> \u4ee5\u4e0a\u3078\u66f4\u65b0<\/strong><\/li>\n\n\n\n<li><strong>\u74b0\u5883\u5909\u6570\u3067\u306f\u306a\u304f <code>with<\/code> \u30d6\u30ed\u30c3\u30af\u3067\u306e Terraform \u30d0\u30fc\u30b8\u30e7\u30f3\u6307\u5b9a\u3092\u512a\u5148\u3002<\/strong><\/li>\n\n\n\n<li><strong><code>defaults: run:<\/code> \u306e <code>working-directory<\/code> \u306f\u30b9\u30c6\u30c3\u30d7\u3054\u3068\u306b\u884c\u3046\u65b9\u304c\u67d4\u8edf\u3002<\/strong><\/li>\n<\/ul>\n\n\n\n<p><strong><code>tf-plan.yml<\/code> \u306e\u4e3b\u8981\u306a\u5909\u66f4\u70b9:<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code># ... (on: pull_request: \u90e8\u5206\u306f\u5909\u66f4\u306a\u3057)\nenv:\n  # ... (AWS\/Terraform\/Snowflake\u306e\u74b0\u5883\u5909\u6570\u306f Secrets\u304b\u3089\u8aad\u307f\u8fbc\u3080)\n  # TF_VERSION: &quot;1.3.0&quot; # setup-terraform\u306ewith\u3067\u6307\u5b9a\u3059\u308b\u3053\u3068\u3092\u63a8\u5968\n\njobs:\n  plan-common:\n    runs-on: ubuntu-latest # \u6700\u65b0\u306eUbuntu\u30e9\u30f3\u30ca\u30fc\u3092\u4f7f\u7528\n    # ... (permissions\u306f\u5909\u66f4\u306a\u3057)\n    strategy:\n      matrix:\n        path:\n          - common-snowflake\n    \n    defaults:\n      run:\n        working-directory: .\/terraform\/project\/${{ matrix.path }} # working-directory\u3092matrix\u306b\u5408\u308f\u305b\u308b\n\n    steps:\n      - uses: actions\/checkout@v4 # \u30a2\u30af\u30b7\u30e7\u30f3\u3092\u6700\u65b0\u7248\u306b\u66f4\u65b0\n\n      - uses: aws-actions\/configure-aws-credentials@v4 # \u30a2\u30af\u30b7\u30e7\u30f3\u3092\u6700\u65b0\u7248\u306b\u66f4\u65b0\n        with:\n          role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role\/mnagaa-github-actions-ro-role\n          aws-region: ${{ env.AWS_REGION }}\n\n      - uses: hashicorp\/setup-terraform@v3 # \u30a2\u30af\u30b7\u30e7\u30f3\u3092\u6700\u65b0\u7248\u306b\u66f4\u65b0\n        with:\n          terraform_version: 1.6.0 # TF_VERSION\u3067\u306f\u306a\u304fwith\u3067\u76f4\u63a5\u6307\u5b9a (\u63a8\u5968)\n\n      - name: Check format\n        run: terraform fmt -check -recursive\n\n      # -chdir=${{ matrix.path }} \u306f defaults:run: \u3067\u8a2d\u5b9a\u6e08\u307f\u306e\u305f\u3081\u4e0d\u8981\n      - name: Init\n        run: terraform init -upgrade -no-color\n\n      - name: Check validate\n        run: terraform validate\n\n      - name: Plan\n        run: terraform plan -no-color -input=false<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">4. Terraform Apply\u3092\u5b9f\u884c\u3059\u308b\u30ef\u30fc\u30af\u30d5\u30ed\u30fc (<code>tf-apply-common.yml<\/code> \u306e\u73fe\u4ee3\u5316)<\/h4>\n\n\n\n<p><code>tf-apply-common.yml<\/code> \u306f\u3001<code>workflow_dispatch<\/code> \u3067\u624b\u52d5\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u512a\u308c\u305f\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>refresh_only<\/code> \u306e\u4ee3\u66ff:<\/strong> Terraform \u306e\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u3001<code>plan<\/code> \u30b3\u30de\u30f3\u30c9\u304c\u81ea\u52d5\u3067\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5\u3092\u884c\u3046\u305f\u3081\u3001\u5c02\u7528\u306e <code>refresh_only<\/code> \u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u4e0d\u8981\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u306f\u3001\u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u306e\u4e92\u63db\u6027\u306e\u305f\u3081\u306b\u6b8b\u3055\u308c\u3066\u3044\u305f <code>refresh_only<\/code> \u30b9\u30c6\u30c3\u30d7\u3092<strong>\u6700\u65b0\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306b\u8fd1\u3065\u3051\u308b\u305f\u3081\u306b\u524a\u9664<\/strong>\u3059\u308b\u304b\u3001<code>plan<\/code> \u306e\u307f\u3092\u884c\u3046\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u3057\u3066\u6b8b\u3059\u3053\u3068\u3092\u63a8\u5968\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong><code>tf-apply-common.yml<\/code> \u306e\u4e3b\u8981\u306a\u5909\u66f4\u70b9:<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code># ... (on: workflow_dispatch: inputs: \u90e8\u5206\u306f\u5909\u66f4\u306a\u3057)\n\njobs:\n  apply-common:\n    # ... (runs-on, permissions, defaults:run: \u306f plan \u3068\u540c\u69d8\u306b\u66f4\u65b0)\n    steps:\n      - uses: actions\/checkout@v4\n\n      - uses: aws-actions\/configure-aws-credentials@v4\n        with:\n          role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role\/mnagaa-github-actions-rw-role # Write\u6a29\u9650\u306e\u30ed\u30fc\u30eb\u3092\u4f7f\u7528\n          aws-region: ${{ env.AWS_REGION }}\n\n      - uses: hashicorp\/setup-terraform@v3\n        with:\n          terraform_version: 1.6.0 # \u6700\u65b0\u7248\u3092\u6307\u5b9a\n\n      - name: Init\n        run: terraform init -upgrade -no-color\n\n      - name: Apply\n        # refresh_only \u306e\u30ab\u30b9\u30bf\u30e0\u30a4\u30f3\u30d7\u30c3\u30c8\u3092\u5229\u7528\u3057\u3066\u3001apply \u3092\u5b9f\u884c\u3059\u308b\u304b\u3092\u5236\u5fa1\n        if: ${{ github.event.inputs.refresh_only == &#39;false&#39; }} \n        run: terraform apply -no-color -auto-approve\n        \n      - name: Plan (Refresh Only\u3068\u3057\u3066\u5b9f\u884c\u3059\u308b\u5834\u5408)\n        # refresh_only \u304c true \u306e\u5834\u5408\u306f\u3001plan \u306e\u5b9f\u884c\u306b\u7559\u3081\u308b\n        if: ${{ github.event.inputs.refresh_only == &#39;true&#39; }} \n        run: terraform plan -no-color -input=false<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u25c9 \u672c\u66f8\u306e\u76ee\u7684 \u30e6\u30fc\u30b6\u30fc\u3001\u30ed\u30fc\u30eb\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3001\u30b9\u30ad\u30fc\u30de\u3092\u306f\u3058\u3081\u3068\u3059\u308bSnowflake\u306e\u30ea\u30bd\u30fc\u30b9\u3092 Terraform\u3067\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 IaC (Infrastructure as Code) \u30c4\u30fc\u30eb<\/p>\n","protected":false},"author":1,"featured_media":3238,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jin_ogp_image_url":"","_jin_last_featured_id":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3185","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/3185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3185"}],"version-history":[{"count":1,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/3185\/revisions"}],"predecessor-version":[{"id":3219,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/3185\/revisions\/3219"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/media\/3238"}],"wp:attachment":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}