{"id":2320,"date":"2025-03-24T08:47:42","date_gmt":"2025-03-23T23:47:42","guid":{"rendered":"https:\/\/dexall.co.jp\/articles\/?p=2320"},"modified":"2025-03-24T08:48:04","modified_gmt":"2025-03-23T23:48:04","slug":"%e3%80%90%e4%bf%9d%e5%ad%98%e7%89%88%e3%80%91terraform%e3%81%a7datadog%e7%92%b0%e5%a2%83%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%e5%ae%8c%e5%85%a8%e3%82%ac%e3%82%a4%e3%83%892024-%e8%a8%ad","status":"publish","type":"post","link":"https:\/\/dexall.co.jp\/articles\/?p=2320","title":{"rendered":"\u3010\u4fdd\u5b58\u7248\u3011Terraform\u3067Datadog\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u5b8c\u5168\u30ac\u30a4\u30c92024 &#8211; \u8a2d\u5b9a\u4f8b20\u500b\u4ed8\u304d"},"content":{"rendered":"\n<div class=\"toc\"><br \/>\n<b>Warning<\/b>:  Undefined array key \"is_admin\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>116<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_category_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>121<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>128<\/b><br \/>\n    <div id=\"toc_container\" class=\"sgb-toc--bullets js-smooth-scroll\" data-dialog-title=\"\u76ee\u6b21\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">Terraform\u3067Datadog\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u30e1\u30ea\u30c3\u30c8<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">Infrastructure as Code\u3067\u5b9f\u73fe\u3059\u308b\u76e3\u8996\u8a2d\u5b9a\u306e\u81ea\u52d5\u5316<\/a>      <\/li>      <li>        <a href=\"#i-2\">\u30b3\u30fc\u30c9\u30ec\u30d3\u30e5\u30fc\u3067\u5b9f\u73fe\u3059\u308b\u76e3\u8996\u54c1\u8cea\u306e\u5411\u4e0a<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-3\">\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u306b\u3088\u308b\u8a2d\u5b9a\u5909\u66f4\u306e\u8ffd\u8de1\u3068rollback<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-4\">Terraform Datadog Provider\u306e\u57fa\u672c\u8a2d\u5b9a<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-5\">API \u30ad\u30fc\u3068 Application \u30ad\u30fc\u306e\u53d6\u5f97\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-6\">provider \u30d6\u30ed\u30c3\u30af\u306e\u8a2d\u5b9a\u4f8b\u3068\u89e3\u8aac<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-7\">\u57fa\u672c\u7684\u306a\u30ea\u30bd\u30fc\u30b9\u5b9a\u7fa9\u306e\u66f8\u304d\u65b9<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-8\">\u5b9f\u8df5\u7684\u306aDatadog\u30ea\u30bd\u30fc\u30b9\u5b9a\u7fa9 \u2013 20\u500b\u306e\u5b9f\u4f8b\u4ed8\u304d<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-9\">\u30e2\u30cb\u30bf\u30fc\u306e\u5b9a\u7fa9\u3068\u95be\u5024\u8a2d\u5b9a\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>      <\/li>      <li>        <a href=\"#i-10\">\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u4f5c\u6210\u306e\u81ea\u52d5\u5316\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-11\">SLO\u306e\u5b9a\u7fa9\u3068\u30c8\u30e9\u30c3\u30ad\u30f3\u30b0\u65b9\u6cd5<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-12\">\u5927\u898f\u6a21\u74b0\u5883\u3067\u306e\u904b\u7528\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-13\">\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u306b\u3088\u308b\u8a2d\u5b9a\u306e\u518d\u5229\u7528\u6027\u5411\u4e0a<\/a>      <\/li>      <li>        <a href=\"#i-14\">\u74b0\u5883\u5225\u306e\u8a2d\u5b9a\u5024\u7ba1\u7406\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-15\">\u30c1\u30fc\u30e0\u9593\u3067\u306e\u8a2d\u5b9a\u5171\u6709\u306e\u30ef\u30fc\u30af\u30d5\u30ed\u30fc<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-16\">\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u30c7\u30d0\u30c3\u30b0<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-17\">\u3088\u304f\u3042\u308b\u30a8\u30e9\u30fc\u3068\u305d\u306e\u89e3\u6c7a\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-18\">\u30c7\u30d0\u30c3\u30b0\u30e2\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u305f\u554f\u984c\u89e3\u6c7a<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-19\">\u8a2d\u5b9a\u5909\u66f4\u306e\u5b89\u5168\u306a\u9069\u7528\u65b9\u6cd5<\/a>      <\/li>    <\/ul>  <\/li><\/ul>\n      <a href=\"#\" class=\"sgb-toc-button js-toc-button\" rel=\"nofollow\" data-open-dialog=\"true\"><i class=\"fa fa-list\"><\/i><span class=\"sgb-toc-button__text\">\u76ee\u6b21\u3078<\/span><\/a>\n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">Terraform\u3067Datadog\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u30e1\u30ea\u30c3\u30c8<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-1\">Infrastructure as Code\u3067\u5b9f\u73fe\u3059\u308b\u76e3\u8996\u8a2d\u5b9a\u306e\u81ea\u52d5\u5316<\/h3>\n\n\n\n<p>Datadog\u306e\u76e3\u8996\u8a2d\u5b9a\u3092Terraform\u3067\u7ba1\u7406\u3059\u308b\u3053\u3068\u3067\u3001\u4ee5\u4e0b\u306e\u81ea\u52d5\u5316\u30e1\u30ea\u30c3\u30c8\u304c\u5f97\u3089\u308c\u307e\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u74b0\u5883\u306e\u4e00\u8cab\u6027\u78ba\u4fdd<\/strong><\/li>\n\n\n\n<li>\u958b\u767a\u30fb\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u30fb\u672c\u756a\u74b0\u5883\u3067\u540c\u4e00\u306e\u76e3\u8996\u8a2d\u5b9a\u3092\u5bb9\u6613\u306b\u5c55\u958b<\/li>\n\n\n\n<li>\u8a2d\u5b9a\u306e\u4e0d\u6574\u5408\u306b\u3088\u308b\u30a4\u30f3\u30b7\u30c7\u30f3\u30c8\u3092\u9632\u6b62<\/li>\n\n\n\n<li><code>terraform workspace<\/code>\u306b\u3088\u308b\u74b0\u5883\u5225\u306e\u8a2d\u5b9a\u5024\u7ba1\u7406<\/li>\n\n\n\n<li><strong>\u8fc5\u901f\u306a\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">  # \u30e2\u30cb\u30bf\u30fc\u8a2d\u5b9a\u306e\u4f8b\n  resource \"datadog_monitor\" \"cpu_usage\" {\n    name    = \"High CPU Usage Alert\"\n    type    = \"metric alert\"\n    message = \"CPU usage is too high\"\n\n    query = \"avg(last_5m):avg:system.cpu.user{environment:production} by {host} &gt; 90\"\n\n    monitor_thresholds {\n      critical = 90\n      warning  = 80\n    }\n  }<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">\u30b3\u30fc\u30c9\u30ec\u30d3\u30e5\u30fc\u3067\u5b9f\u73fe\u3059\u308b\u76e3\u8996\u54c1\u8cea\u306e\u5411\u4e0a<\/h3>\n\n\n\n<p>Terraform\u30b3\u30fc\u30c9\u306b\u3088\u308b\u76e3\u8996\u8a2d\u5b9a\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u306b\u3088\u308a\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GitHub\u306a\u3069\u3067\u306ePR\u30d9\u30fc\u30b9\u306e\u30ec\u30d3\u30e5\u30fc\u5b9f\u65bd<\/li>\n\n\n\n<li>\u8a2d\u5b9a\u5909\u66f4\u306e\u610f\u56f3\u3084\u80cc\u666f\u306e\u660e\u78ba\u5316<\/li>\n\n\n\n<li>\u30c1\u30fc\u30e0\u5168\u4f53\u3067\u306e\u77e5\u898b\u5171\u6709\u3068\u54c1\u8cea\u5411\u4e0a<\/li>\n\n\n\n<li>\u8a2d\u5b9a\u30df\u30b9\u306e\u65e9\u671f\u767a\u898b<\/li>\n<\/ul>\n\n\n\n<p>\u4f8b\uff1a\u30ec\u30d3\u30e5\u30fc\u6642\u306e\u78ba\u8a8d\u30dd\u30a4\u30f3\u30c8<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># SLO\u306e\u5b9a\u7fa9\u4f8b\nresource \"datadog_service_level_objective\" \"http_requests\" {\n  name        = \"HTTP Requests Success Rate\"\n  type        = \"metric\"\n  description = \"SLO tracking success rate of HTTP requests\"\n\n  thresholds {\n    timeframe = \"7d\"\n    target    = 99.9\n    warning   = 99.95\n  }\n\n  query {\n    numerator   = \"sum:http.requests.success{*}\"\n    denominator = \"sum:http.requests.total{*}\"\n  }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-3\">\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u306b\u3088\u308b\u8a2d\u5b9a\u5909\u66f4\u306e\u8ffd\u8de1\u3068rollback<\/h3>\n\n\n\n<p>Git\u3067\u306e\u5909\u66f4\u5c65\u6b74\u7ba1\u7406\u306b\u3088\u308a\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8a2d\u5b9a\u5909\u66f4\u306e\u8ffd\u8de1\u53ef\u80fd\u6027\u78ba\u4fdd<\/li>\n\n\n\n<li>\u554f\u984c\u767a\u751f\u6642\u306e\u539f\u56e0\u7279\u5b9a\u304c\u5bb9\u6613<\/li>\n\n\n\n<li><code>terraform plan<\/code>\u306b\u3088\u308b\u5909\u66f4\u5f71\u97ff\u306e\u4e8b\u524d\u78ba\u8a8d<\/li>\n\n\n\n<li>\u5fc5\u8981\u306b\u5fdc\u3058\u305f\u8a2d\u5b9a\u306e\u5dfb\u304d\u623b\u3057<\/li>\n<\/ul>\n\n\n\n<p>\u5909\u66f4\u7ba1\u7406\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u30d6\u30e9\u30f3\u30c1\u904b\u7528\u306b\u3088\u308b\u5909\u66f4\u306e\u5206\u96e2<\/li>\n\n\n\n<li>terraform plan\u306e\u7d50\u679c\u3092PR\u306b\u30b3\u30e1\u30f3\u30c8<\/li>\n\n\n\n<li>\u627f\u8a8d\u30d5\u30ed\u30fc\u3068\u9023\u643a\u3057\u305f\u9069\u7528\u7ba1\u7406<\/li>\n\n\n\n<li>\u5909\u66f4\u5c65\u6b74\u306e\u6587\u66f8\u5316<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-4\">Terraform Datadog Provider\u306e\u57fa\u672c\u8a2d\u5b9a<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-5\">API \u30ad\u30fc\u3068 Application \u30ad\u30fc\u306e\u53d6\u5f97\u65b9\u6cd5<\/h3>\n\n\n\n<p>Datadog\u3068\u306e\u9023\u643a\u306b\u5fc5\u8981\u306a\u30ad\u30fc\u306f\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>API \u30ad\u30fc\u306e\u53d6\u5f97<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Datadog\u30b3\u30f3\u30bd\u30fc\u30eb\u306e[Organization Settings] &gt; [API Keys]\u306b\u79fb\u52d5<\/li>\n\n\n\n<li>[New Key]\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u65b0\u898fAPI \u30ad\u30fc\u3092\u4f5c\u6210<\/li>\n\n\n\n<li>\u30ad\u30fc\u306e\u7528\u9014\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u540d\u524d\u3092\u8a2d\u5b9a\uff08\u4f8b\uff1a<code>terraform-integration<\/code>\uff09<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Application \u30ad\u30fc\u306e\u53d6\u5f97<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>[Organization Settings] &gt; [Application Keys]\u306b\u79fb\u52d5<\/li>\n\n\n\n<li>[New Key]\u304b\u3089\u65b0\u898fApplication \u30ad\u30fc\u3092\u4f5c\u6210<\/li>\n\n\n\n<li>\u5fc5\u8981\u6700\u5c0f\u9650\u306e\u6a29\u9650\u3092\u4ed8\u4e0e<\/li>\n<\/ul>\n\n\n\n<p>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30ad\u30fc\u306f\u74b0\u5883\u5909\u6570\u3068\u3057\u3066\u7ba1\u7406<\/li>\n\n\n\n<li>GitHub\u306a\u3069\u306b\u30ad\u30fc\u3092\u76f4\u63a5\u30b3\u30df\u30c3\u30c8\u3057\u306a\u3044<\/li>\n\n\n\n<li>\u5b9a\u671f\u7684\u306a\u30ad\u30fc\u306e\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u5b9f\u65bd<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-6\">provider \u30d6\u30ed\u30c3\u30af\u306e\u8a2d\u5b9a\u4f8b\u3068\u89e3\u8aac<\/h3>\n\n\n\n<p>\u57fa\u672c\u7684\u306aprovider\u8a2d\u5b9a\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u306e\u8981\u4ef6\u5b9a\u7fa9\nterraform {\n  required_providers {\n    datadog = {\n      source  = \"DataDog\/datadog\"\n      version = \"~&gt; 3.30.0\"  # \u6700\u65b0\u306e\u5b89\u5b9a\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u6307\u5b9a\n    }\n  }\n}\n\n# \u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u306e\u8a2d\u5b9a\nprovider \"datadog\" {\n  api_key = var.datadog_api_key\n  app_key = var.datadog_app_key\n  api_url = \"https:\/\/api.datadoghq.com\/\"  # \u30ea\u30fc\u30b8\u30e7\u30f3\u306b\u5fdc\u3058\u3066\u5909\u66f4\n}\n\n# \u5909\u6570\u5b9a\u7fa9\nvariable \"datadog_api_key\" {\n  type        = string\n  description = \"Datadog API Key\"\n  sensitive   = true  # \u6a5f\u5bc6\u60c5\u5831\u3068\u3057\u3066\u30de\u30fc\u30af\n}\n\nvariable \"datadog_app_key\" {\n  type        = string\n  description = \"Datadog Application Key\"\n  sensitive   = true\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-7\">\u57fa\u672c\u7684\u306a\u30ea\u30bd\u30fc\u30b9\u5b9a\u7fa9\u306e\u66f8\u304d\u65b9<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30e2\u30cb\u30bf\u30fc\u306e\u57fa\u672c\u5b9a\u7fa9<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_monitor\" \"basic_monitor\" {\n  name    = \"Basic System Monitor\"\n  type    = \"metric alert\"\n  message = \"Memory usage is high on {{host.name}}\\n@slack-alerts\"\n\n  query = \"avg(last_5m):avg:system.mem.used{environment:production} by {host} &gt; 85\"\n\n  monitor_thresholds {\n    critical = 85\n    warning  = 75\n  }\n\n  notify_no_data    = true\n  evaluation_delay  = 300\n  include_tags      = true\n\n  tags = [\"env:production\", \"team:infrastructure\"]\n}<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u57fa\u672c\u5b9a\u7fa9<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_dashboard\" \"basic_dashboard\" {\n  title       = \"System Overview\"\n  layout_type = \"ordered\"\n\n  widget {\n    timeseries_definition {\n      title = \"CPU Usage\"\n      request {\n        q            = \"avg:system.cpu.user{*} by {host}\"\n        display_type = \"line\"\n      }\n    }\n  }\n}<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u30bf\u30b0\u306e\u4ed8\u4e0e\u898f\u5247<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u30b0\u30ed\u30fc\u30d0\u30eb\u30bf\u30b0\u306e\u5b9a\u7fa9\u4f8b\nresource \"datadog_monitor\" \"tagged_monitor\" {\n  # ... \u57fa\u672c\u8a2d\u5b9a ...\n\n  tags = concat(\n    var.global_tags,\n    [\n      \"service:${var.service_name}\",\n      \"env:${var.environment}\",\n      \"managed-by:terraform\"\n    ]\n  )\n}<\/pre>\n\n\n\n<p>\u5b9f\u88c5\u306e\u30dd\u30a4\u30f3\u30c8\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30ea\u30bd\u30fc\u30b9\u540d\u306f\u660e\u78ba\u3067\u4e00\u8cab\u6027\u306e\u3042\u308b\u547d\u540d\u898f\u5247\u3092\u4f7f\u7528<\/li>\n\n\n\n<li>\u5fc5\u8981\u306a\u5c5e\u6027\u306f\u5168\u3066\u660e\u793a\u7684\u306b\u6307\u5b9a<\/li>\n\n\n\n<li>\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306b\u4f9d\u5b58\u3057\u306a\u3044<\/li>\n\n\n\n<li>\u5909\u6570\u5316\u3057\u3066\u518d\u5229\u7528\u53ef\u80fd\u306a\u8a2d\u8a08\u306b<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-8\">\u5b9f\u8df5\u7684\u306aDatadog\u30ea\u30bd\u30fc\u30b9\u5b9a\u7fa9 \u2013 20\u500b\u306e\u5b9f\u4f8b\u4ed8\u304d<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-9\">\u30e2\u30cb\u30bf\u30fc\u306e\u5b9a\u7fa9\u3068\u95be\u5024\u8a2d\u5b9a\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30de\u30eb\u30c1\u30a2\u30e9\u30fc\u30c8 CPU \u30e2\u30cb\u30bf\u30fc<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_monitor\" \"cpu_high\" {\n  name    = \"[${var.env}] High CPU Usage\"\n  type    = \"metric alert\"\n  message = &lt;&lt;-EOT\n    CPU usage is high on {{host.name}}\n    Usage: {{value}}%\n\n    Actions:\n    1. Check system load\n    2. Review running processes\n    3. Scale if necessary\n\n    @team-sre@company.com\n  EOT\n\n  query = \"avg(last_5m):avg:system.cpu.user{environment:${var.env}} by {host} &gt; 85\"\n\n  monitor_thresholds {\n    critical          = 85\n    warning           = 75\n    critical_recovery = 80\n    warning_recovery  = 70\n  }\n\n  evaluation_delay = 300\n  new_host_delay  = 300\n  notify_audit    = true\n  timeout_h       = 0\n  include_tags    = true\n\n  tags = [\"team:sre\", \"criticality:high\"]\n}<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u30e1\u30e2\u30ea\u30ea\u30fc\u30af\u691c\u77e5\u30e2\u30cb\u30bf\u30fc<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_monitor\" \"memory_leak\" {\n  name    = \"Memory Leak Detection\"\n  type    = \"metric alert\"\n  query   = \"avg(last_30m):derivative(avg:system.mem.used{environment:prod} by {host}) &gt; 0.1\"\n  message = \"Potential memory leak detected on {{host.name}}\"\n}<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u30c7\u30a3\u30b9\u30af\u4f7f\u7528\u91cf\u4e88\u6e2c\u30e2\u30cb\u30bf\u30fc<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_monitor\" \"disk_prediction\" {\n  name  = \"Disk Usage Prediction\"\n  type  = \"metric alert\"\n  query = \"forecast(avg:system.disk.in_use{*}, 'linear', 24, interval='60m', history='1w') &gt; 90\"\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-10\">\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u4f5c\u6210\u306e\u81ea\u52d5\u5316\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30b7\u30b9\u30c6\u30e0\u6982\u8981\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_dashboard\" \"system_overview\" {\n  title       = \"System Overview\"\n  layout_type = \"ordered\"\n\n  widget {\n    group_definition {\n      title = \"System Metrics\"\n\n      widget {\n        timeseries_definition {\n          title = \"CPU Usage\"\n          request {\n            q = \"avg:system.cpu.user{*} by {host}\"\n            display_type = \"line\"\n          }\n        }\n      }\n\n      widget {\n        timeseries_definition {\n          title = \"Memory Usage\"\n          request {\n            q = \"avg:system.mem.used{*} by {host}\"\n          }\n        }\n      }\n    }\n  }\n\n  widget {\n    alert_graph_definition {\n      title = \"Alert Status\"\n      alert_id = datadog_monitor.cpu_high.id\n      viz_type = \"timeseries\"\n    }\n  }\n}<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u30ab\u30b9\u30bf\u30e0\u30e1\u30c8\u30ea\u30af\u30b9\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_dashboard\" \"custom_metrics\" {\n  title       = \"Application Metrics\"\n  layout_type = \"ordered\"\n\n  widget {\n    query_value_definition {\n      title = \"Total Users\"\n      request {\n        q = \"sum:custom.users.total{*}\"\n      }\n    }\n  }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-11\">SLO\u306e\u5b9a\u7fa9\u3068\u30c8\u30e9\u30c3\u30ad\u30f3\u30b0\u65b9\u6cd5<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>API\u30ec\u30a4\u30c6\u30f3\u30b7\u30fcSLO<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_service_level_objective\" \"api_latency\" {\n  name        = \"API Latency SLO\"\n  type        = \"monitor\"\n  description = \"Track API endpoint response times\"\n\n  thresholds {\n    timeframe = \"7d\"\n    target    = 99.9\n    warning   = 99.95\n  }\n\n  monitor_ids = [\n    datadog_monitor.api_latency.id\n  ]\n}<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u53ef\u7528\u6027SLO<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">resource \"datadog_service_level_objective\" \"availability\" {\n  name        = \"Service Availability\"\n  type        = \"metric\"\n  description = \"Track service uptime\"\n\n  thresholds {\n    timeframe = \"30d\"\n    target    = 99.99\n    warning   = 99.995\n  }\n\n  query {\n    numerator   = \"sum:http.requests.success{*}\"\n    denominator = \"sum:http.requests.total{*}\"\n  }\n}<\/pre>\n\n\n\n<p>\u5b9f\u88c5\u306e\u30dd\u30a4\u30f3\u30c8\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e2\u30cb\u30bf\u30fc\u306e\u91cd\u8981\u5ea6\u306b\u5fdc\u3058\u305f\u901a\u77e5\u8a2d\u5b9a<\/li>\n\n\n\n<li>\u9069\u5207\u306a\u8a55\u4fa1\u671f\u9593\u3068delay\u8a2d\u5b9a<\/li>\n\n\n\n<li>\u30e1\u30c3\u30bb\u30fc\u30b8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u6a19\u6e96\u5316<\/li>\n\n\n\n<li>\u74b0\u5883\u5909\u6570\u306b\u3088\u308b\u95be\u5024\u7ba1\u7406<\/li>\n\n\n\n<li>\u30bf\u30b0\u306b\u3088\u308b\u95a2\u9023\u4ed8\u3051<\/li>\n\n\n\n<li>\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u968e\u5c64\u5316<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-12\">\u5927\u898f\u6a21\u74b0\u5883\u3067\u306e\u904b\u7528\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-13\">\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u306b\u3088\u308b\u8a2d\u5b9a\u306e\u518d\u5229\u7528\u6027\u5411\u4e0a<\/h3>\n\n\n\n<p>\u57fa\u672c\u30e2\u30b8\u30e5\u30fc\u30eb\u69cb\u9020\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># modules\/datadog-monitor\/variables.tf\nvariable \"environment\" {\n  type        = string\n  description = \"\u74b0\u5883\u8b58\u5225\u5b50\uff08prod\/stg\/dev\uff09\"\n}\n\nvariable \"service\" {\n  type = object({\n    name        = string\n    team        = string\n    criticality = string\n  })\n}\n\n# modules\/datadog-monitor\/main.tf\nlocals {\n  common_tags = {\n    environment = var.environment\n    service     = var.service.name\n    team        = var.service.team\n    managed_by  = \"terraform\"\n  }\n}\n\nresource \"datadog_monitor\" \"service_health\" {\n  for_each = local.monitor_configs\n\n  name    = \"[${var.environment}][${var.service.name}] ${each.value.name}\"\n  type    = each.value.type\n  query   = each.value.query\n  message = each.value.message\n\n  monitor_thresholds {\n    critical = each.value.thresholds.critical\n    warning  = each.value.thresholds.warning\n  }\n\n  tags = merge(local.common_tags, each.value.additional_tags)\n}<\/pre>\n\n\n\n<p>\u30e2\u30b8\u30e5\u30fc\u30eb\u4f7f\u7528\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># environments\/prod\/monitoring.tf\nmodule \"api_monitoring\" {\n  source = \"..\/..\/modules\/datadog-monitor\"\n\n  environment = \"prod\"\n  service = {\n    name        = \"payment-api\"\n    team        = \"platform\"\n    criticality = \"high\"\n  }\n\n  monitor_configs = {\n    cpu = {\n      type    = \"metric alert\"\n      query   = \"avg(last_5m):avg:system.cpu.user{service:payment-api} by {host} &gt; 85\"\n      message = \"CPU\u4f7f\u7528\u7387\u304c\u95be\u5024\u3092\u8d85\u904e\u3057\u3066\u3044\u307e\u3059\"\n      thresholds = {\n        critical = 85\n        warning  = 75\n      }\n    }\n  }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-14\">\u74b0\u5883\u5225\u306e\u8a2d\u5b9a\u5024\u7ba1\u7406\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># terraform.tfvars.json\n{\n  \"environments\": {\n    \"prod\": {\n      \"thresholds\": {\n        \"cpu\": { \"critical\": 85, \"warning\": 75 },\n        \"memory\": { \"critical\": 90, \"warning\": 80 }\n      },\n      \"notification\": {\n        \"channels\": [\"#prod-alerts\", \"@pagerduty-prod\"],\n        \"escalation_minutes\": 15\n      }\n    },\n    \"stg\": {\n      \"thresholds\": {\n        \"cpu\": { \"critical\": 90, \"warning\": 80 },\n        \"memory\": { \"critical\": 95, \"warning\": 85 }\n      },\n      \"notification\": {\n        \"channels\": [\"#stg-alerts\"],\n        \"escalation_minutes\": 30\n      }\n    }\n  }\n}\n\n# variables.tf\nlocals {\n  env_config = lookup(var.environments, terraform.workspace, var.environments[\"dev\"])\n}\n\n# \u30e2\u30cb\u30bf\u30fc\u5b9a\u7fa9\u3067\u306e\u4f7f\u7528\nresource \"datadog_monitor\" \"cpu_alert\" {\n  name = \"[${terraform.workspace}] CPU Alert\"\n  query = format(\n    \"avg(last_5m):avg:system.cpu.user{environment:%s} by {host} &gt; %d\",\n    terraform.workspace,\n    local.env_config.thresholds.cpu.critical\n  )\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-15\">\u30c1\u30fc\u30e0\u9593\u3067\u306e\u8a2d\u5b9a\u5171\u6709\u306e\u30ef\u30fc\u30af\u30d5\u30ed\u30fc<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30ec\u30d3\u30e5\u30fc\u30d7\u30ed\u30bb\u30b9\u306e\u81ea\u52d5\u5316<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># .github\/workflows\/terraform.yml\nname: Terraform Review\non: [pull_request]\n\njobs:\n  terraform:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\/checkout@v3\n\n      - name: Setup Terraform\n        uses: hashicorp\/setup-terraform@v2\n\n      - name: Terraform Format\n        run: terraform fmt -check -recursive\n\n      - name: Terraform Init\n        run: |\n          for dir in environments\/*; do\n            if [ -d \"$dir\" ]; then\n              cd $dir\n              terraform init -backend=false\n              cd ..\/..\/\n            fi\n          done\n\n      - name: Terraform Validate\n        run: |\n          for dir in environments\/*; do\n            if [ -d \"$dir\" ]; then\n              cd $dir\n              terraform validate\n              cd ..\/..\/\n            fi\n          done\n\n      - name: Terraform Plan\n        run: |\n          for dir in environments\/*; do\n            if [ -d \"$dir\" ]; then\n              cd $dir\n              terraform plan -no-color\n              cd ..\/..\/\n            fi\n          done<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u5909\u66f4\u9069\u7528\u306e\u5236\u5fa1<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># backend.tf\nterraform {\n  backend \"s3\" {\n    bucket         = \"terraform-state\"\n    key            = \"datadog\/monitoring.tfstate\"\n    region         = \"ap-northeast-1\"\n    encrypt        = true\n    dynamodb_table = \"terraform-locks\"\n  }\n}\n\n# providers.tf\nprovider \"datadog\" {\n  api_key = data.aws_ssm_parameter.datadog_api_key.value\n  app_key = data.aws_ssm_parameter.datadog_app_key.value\n\n  validate = true\n}\n\ndata \"aws_ssm_parameter\" \"datadog_api_key\" {\n  name = \"\/datadog\/${terraform.workspace}\/api_key\"\n}\n\ndata \"aws_ssm_parameter\" \"datadog_app_key\" {\n  name = \"\/datadog\/${terraform.workspace}\/app_key\"\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-16\">\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u30c7\u30d0\u30c3\u30b0<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-17\">\u3088\u304f\u3042\u308b\u30a8\u30e9\u30fc\u3068\u305d\u306e\u89e3\u6c7a\u65b9\u6cd5<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u8a8d\u8a3c\u30a8\u30e9\u30fc<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Error: error querying datadog monitor: error querying monitor: API error 403: Forbidden<\/pre>\n\n\n\n<p>\u89e3\u6c7a\u65b9\u6cd5:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u74b0\u5883\u5909\u6570\u306e\u78ba\u8a8d\nprintenv | grep DATADOG\n# \u307e\u305f\u306f\necho $DATADOG_API_KEY\necho $DATADOG_APP_KEY\n\n# API\/APP\u30ad\u30fc\u306e\u518d\u8a2d\u5b9a\nexport DATADOG_API_KEY=\"your_api_key\"\nexport DATADOG_APP_KEY=\"your_app_key\"<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u30ea\u30bd\u30fc\u30b9\u7af6\u5408<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Error: error updating datadog dashboard: API error 409: A dashboard with name 'System Overview' already exists<\/pre>\n\n\n\n<p>\u89e3\u6c7a\u65b9\u6cd5:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u30ea\u30bd\u30fc\u30b9\u540d\u306e\u4e00\u610f\u6027\u78ba\u4fdd\nresource \"datadog_dashboard\" \"system_overview\" {\n  title       = \"${var.environment}-${var.service_name}-system-overview\"\n  layout_type = \"ordered\"\n  # ...\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-18\">\u30c7\u30d0\u30c3\u30b0\u30e2\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u305f\u554f\u984c\u89e3\u6c7a<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u8a73\u7d30\u30ed\u30b0\u306e\u6709\u52b9\u5316<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u30c7\u30d0\u30c3\u30b0\u30e2\u30fc\u30c9\u3067\u306e\u5b9f\u884c\nTF_LOG=DEBUG terraform apply\n\n# \u30ed\u30b0\u306e\u4fdd\u5b58\nTF_LOG=DEBUG TF_LOG_PATH=.\/terraform.log terraform plan<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>API\u901a\u4fe1\u306e\u78ba\u8a8d<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">provider \"datadog\" {\n  api_key = var.datadog_api_key\n  app_key = var.datadog_app_key\n\n  # API\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u691c\u8a3c\u3092\u6709\u52b9\u5316\n  validate = true\n\n  # \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u8a2d\u5b9a\n  api_timeout = 30\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-19\">\u8a2d\u5b9a\u5909\u66f4\u306e\u5b89\u5168\u306a\u9069\u7528\u65b9\u6cd5<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5909\u66f4\u8a08\u753b\u306e\u691c\u8a3c<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u8a73\u7d30\u306a\u5dee\u5206\u78ba\u8a8d\nterraform plan -detailed-exitcode\n\n# \u7279\u5b9a\u30ea\u30bd\u30fc\u30b9\u306e\u307f\u78ba\u8a8d\nterraform plan -target=datadog_monitor.cpu_high<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u6bb5\u968e\u7684\u306a\u30ed\u30fc\u30eb\u30a2\u30a6\u30c8<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u30c6\u30b9\u30c8\u7528\u30e2\u30cb\u30bf\u30fc\u306e\u4f5c\u6210\nresource \"datadog_monitor\" \"test_monitor\" {\n  count = terraform.workspace == \"dev\" ? 1 : 0\n\n  name    = \"Test Monitor\"\n  type    = \"metric alert\"\n  message = \"Test alert message\"\n\n  query = \"avg(last_5m):avg:system.cpu.user{environment:dev} by {host} &gt; 90\"\n}\n\n# \u672c\u756a\u9069\u7528\u524d\u306e\u691c\u8a3c\nlocals {\n  is_production = terraform.workspace == \"prod\"\n\n  monitor_thresholds = {\n    dev = {\n      critical = 90\n      warning  = 80\n    }\n    prod = {\n      critical = 85\n      warning  = 75\n    }\n  }\n}<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u6226\u7565<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u72b6\u614b\u306e\u78ba\u8a8d\nterraform show\n\n# \u7279\u5b9a\u30d0\u30fc\u30b8\u30e7\u30f3\u3078\u306e\u623b\u3057\u65b9\ngit checkout &lt;previous_commit&gt;\nterraform plan\nterraform apply<\/pre>\n\n\n\n<p>\u5b9f\u88c5\u306e\u30dd\u30a4\u30f3\u30c8:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u8a73\u7d30\u306a\u89e3\u6790<\/li>\n\n\n\n<li>\u30b9\u30c6\u30fc\u30c8\u7ba1\u7406\u306e\u5b9a\u671f\u7684\u306a\u78ba\u8a8d<\/li>\n\n\n\n<li>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306e\u4fdd\u6301<\/li>\n\n\n\n<li>\u5909\u66f4\u5c65\u6b74\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u5316<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Warning: Undefined array key &#8220;is_admin&#8221; in \/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/ &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":{"0":"post-2320","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-aws","7":"nothumb"},"_links":{"self":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/2320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2320"}],"version-history":[{"count":1,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/2320\/revisions"}],"predecessor-version":[{"id":2321,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/2320\/revisions\/2321"}],"wp:attachment":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}