<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
  <title>Architect&#39;s Log</title>
  
  <subtitle>I&#39;m a Cloud Architect. I&#39;m highly motivated to reduce toils with driving DevOps.</subtitle>
  
  <link href="https://blog.jhashimoto.net/"/>
  <updated>2026-06-09T16:35:26+09:00</updated>
  <author>
    <name>JHashimoto</name>
  </author>
  <generator uri="https://blog.hatena.ne.jp/" version="d505c803bfa0d6e44af2d9b7a647c4">Hatena::Blog</generator>
  <id>hatenablog://blog/12921228815716984990</id>

  
    
    
    <entry>
        <title>Today I Learned - 2026-06-09</title>
        <link href="https://blog.jhashimoto.net/entry/2026/06/09/163526"/>
        <id>hatenablog://entry/14945776032040514357</id>
        <published>2026-06-09T16:35:26+09:00</published>
        <updated>2026-06-09T16:35:27+09:00</updated>        <summary type="html">今日学んだことを雑多に書く。 route53:GetHostedZoneのPermissionエラーでCloudFormationスタックのデプロイに失敗する AccessDenied. User doesn&#39;t have permission to call route53:GetHostedZone. Rollback requested by user. テンプレートのパラメータで Route53 ホストゾーンを型指定している yaml HostedZoneId: Type: AWS::Route53::HostedZone::Id Default: Z0123xxxxxxxxxxxxx…</summary>
        <content type="html">&lt;p&gt;今日学んだことを雑多に書く。&lt;/p&gt;

&lt;h2 id=&quot;route53GetHostedZoneのPermissionエラーでCloudFormationスタックのデプロイに失敗する&quot;&gt;route53:GetHostedZoneのPermissionエラーでCloudFormationスタックのデプロイに失敗する&lt;/h2&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;AccessDenied. User doesn&lt;span class=&quot;synStatement&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;t have permission to call route53:GetHostedZone. Rollback requested by user.&lt;/span&gt;
&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;テンプレートのパラメータで Route53 ホストゾーンを型指定している
  &lt;code&gt;yaml
  HostedZoneId:
      Type: AWS::Route53::HostedZone::Id
      Default: Z0123xxxxxxxxxxxxxxxx
      Description: Route53 hosted zone ID.
 &lt;/code&gt;&lt;/li&gt;
&lt;li&gt;マネージメントコンソールでデプロイしている&lt;/li&gt;
&lt;li&gt;CloudFormation のサービスロールで&lt;code&gt;route53:GetHostedZone&lt;/code&gt;を許可している&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;デフォルト値の&lt;code&gt;Z0123xxxxxxxxxxxxxxxx&lt;/code&gt;が、その環境に存在しないホストゾーン ID だったことが原因。おそらくデプロイの際に内部的に&lt;code&gt;route53:GetHostedZone&lt;/code&gt;を実行していると思われる。&lt;/p&gt;

&lt;p&gt;解決策は&lt;code&gt;Default&lt;/code&gt;属性の削除か、または&lt;code&gt;Type&lt;/code&gt;属性を&lt;code&gt;String&lt;/code&gt;に変更する。&lt;/p&gt;

&lt;p&gt;なお、サービスロールを指定しない場合はサインインユーザーの認証情報がスタックデプロイに使用される。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/using-iam-servicerole.html&quot;&gt;https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/using-iam-servicerole.html&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;CloudFormation はデフォルトで、スタックオペレーションのためのユーザー認証情報から CloudFormation が生成する一時的なセッションを使用します。サービスロールを指定すると、CloudFormation はロールの認証情報を使用します。&lt;/p&gt;&lt;/blockquote&gt;

&lt;h2 id=&quot;Lambda関数にCloudFormationでタグをつける&quot;&gt;Lambda関数にCloudFormationでタグをつける&lt;/h2&gt;

&lt;pre class=&quot;code lang-yaml&quot; data-lang=&quot;yaml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Resources&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;StartStepFunctionLambda&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; AWS::Lambda::Function
    &lt;span class=&quot;synIdentifier&quot;&gt;Properties&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;synIdentifier&quot;&gt;FunctionName&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; StartStepFunctionLambda
     &lt;span class=&quot;synComment&quot;&gt; # ... その他のプロパティ&lt;/span&gt;
      &lt;span class=&quot;synIdentifier&quot;&gt;Tags&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Key&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; Environment
          &lt;span class=&quot;synIdentifier&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; production
        &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Key&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; Project
          &lt;span class=&quot;synIdentifier&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; my-project
&lt;/pre&gt;

</content>        
        <category term="TIL" label="TIL" />
        
        <category term="CloudFormation" label="CloudFormation" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/14945776032040514357/1780990526" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Today I Learned - 2026-06-08</title>
        <link href="https://blog.jhashimoto.net/entry/2026/06/08/205538"/>
        <id>hatenablog://entry/14945776032040244528</id>
        <published>2026-06-08T20:55:38+09:00</published>
        <updated>2026-06-09T16:19:03+09:00</updated>        <summary type="html">今日学んだことを雑多に書く。 CloudFormationパラメータのTips デフォルト値。 Parameters: StateMachineArn: Type: String Description: ARN of the Step Functions state machine to start. Default: arn:aws:states:ap-northeast-1:123456789:stateMachine:AddRdsReader 許可リスト。 Parameters: DBInstanceClass: Type: String AllowedValues: - db.r8g…</summary>
        <content type="html">&lt;p&gt;今日学んだことを雑多に書く。&lt;/p&gt;

&lt;h2 id=&quot;CloudFormationパラメータのTips&quot;&gt;CloudFormationパラメータのTips&lt;/h2&gt;

&lt;p&gt;デフォルト値。&lt;/p&gt;

&lt;pre class=&quot;code lang-yaml&quot; data-lang=&quot;yaml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;StateMachineArn&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; String
    &lt;span class=&quot;synIdentifier&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; ARN of the Step Functions state machine to start.
    &lt;span class=&quot;synIdentifier&quot;&gt;Default&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; arn:aws:states:ap-northeast-1:123456789:stateMachine:AddRdsReader
&lt;/pre&gt;


&lt;p&gt;許可リスト。&lt;/p&gt;

&lt;pre class=&quot;code lang-yaml&quot; data-lang=&quot;yaml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;DBInstanceClass&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; String
    &lt;span class=&quot;synIdentifier&quot;&gt;AllowedValues&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; 
      &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;db.r8g.xlarge
      &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;db.r8g.2xlarge
      &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;db.r8g.4xlarge
      &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;db.r8g.8xlarge
      &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;db.r8g.12xlarge
      &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;db.r8g.16xlarge
      &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;db.r8g.24xlarge
      &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;db.r8g.48xlarge
&lt;/pre&gt;


&lt;p&gt;入力パターン。正規表現で指定。&lt;/p&gt;

&lt;pre class=&quot;code lang-yaml&quot; data-lang=&quot;yaml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;DBInstanceClass&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; String
    &lt;span class=&quot;synIdentifier&quot;&gt;AllowedPattern&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; ^db\.r8g\.(\d+)?xlarge$
&lt;/pre&gt;


&lt;p&gt;AWS リソース。&lt;/p&gt;

&lt;pre class=&quot;code lang-yaml&quot; data-lang=&quot;yaml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;AvailabilityZone&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; AWS::EC2::AvailabilityZone::Name
&lt;/pre&gt;


&lt;p&gt;AWS リソースのリスト。複数選択可。&lt;/p&gt;

&lt;pre class=&quot;code lang-yaml&quot; data-lang=&quot;yaml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;AvailabilityZone&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; List&amp;lt;AWS::EC2::AvailabilityZone::Name&amp;gt;
&lt;/pre&gt;


&lt;p&gt;最小値。最大値。&lt;/p&gt;

&lt;pre class=&quot;code lang-yaml&quot; data-lang=&quot;yaml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;PromotionTier&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; Number
    &lt;span class=&quot;synIdentifier&quot;&gt;MinValue&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;MaxValue&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;15&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;参考。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html&quot;&gt;https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/cloudformation-supplied-parameter-types.html&quot;&gt;https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/cloudformation-supplied-parameter-types.html&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;ncコマンドでの疎通確認&quot;&gt;ncコマンドでの疎通確認&lt;/h2&gt;

&lt;p&gt;Ubuntsu on WSL で確認。&lt;/p&gt;

&lt;p&gt;待ち受けておく。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;nc &lt;span class=&quot;synSpecial&quot;&gt;-lk&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;8443&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;別ターミナルから接続。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;&lt;span class=&quot;synStatement&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;OK&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; &lt;/span&gt;| nc &lt;span class=&quot;synSpecial&quot;&gt;-q&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; localhost &lt;span class=&quot;synConstant&quot;&gt;8443&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;出力される。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;nc &lt;span class=&quot;synSpecial&quot;&gt;-lk&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;8443&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# OK&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;-l&lt;/code&gt;: Listen モード&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-k&lt;/code&gt;: Keep inbound sockets open for multiple connects. 切断後も同じポートで次の接続を待ち続ける。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-q 0&lt;/code&gt;: quit after EOF on stdin and delay of secs. STDIN で EOF 後すぐに閉じる。&lt;/p&gt;

&lt;h2 id=&quot;ncコマンドで200を返す&quot;&gt;ncコマンドで200を返す&lt;/h2&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;&lt;span class=&quot;synStatement&quot;&gt;while true; do&lt;/span&gt;
  &lt;span class=&quot;synStatement&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; -e &lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;HTTP/1.1 200 OK&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Content-Length: 3&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;\r\n\r\n&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;OK&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;|&lt;/span&gt; nc &lt;span class=&quot;synStatement&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;8443&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;done&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;別ターミナルから接続。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;&lt;span class=&quot;synStatement&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; &lt;/span&gt;| nc &lt;span class=&quot;synSpecial&quot;&gt;-q&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; localhost &lt;span class=&quot;synConstant&quot;&gt;8443&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# HTTP/1.1 200 OK&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# Content-Length: 3&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# &lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# OK&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# &lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;-q 0&lt;/code&gt;によるクローズを発動させるには、echo をパイプでつなぐ。パイプの書き込み側が閉じられると、読み込み側（nc の stdin）は「もう読むデータはない」(EOF) と認識する。&lt;/p&gt;
</content>        
        <category term="TIL" label="TIL" />
        
        <category term="CloudFormation" label="CloudFormation" />
        
        <category term="nc" label="nc" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/14945776032040244528/1780989542" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Today I Learned - 2026-06-05</title>
        <link href="https://blog.jhashimoto.net/entry/2026/06/05/211511"/>
        <id>hatenablog://entry/14945776032039132715</id>
        <published>2026-06-05T21:15:11+09:00</published>
        <updated>2026-06-05T21:24:13+09:00</updated>        <summary type="html">今日学んだことを雑多に書く。 Lambda関数をCloudFormationでデプロイする Lambda 関数を CloudFormation でデプロイしたい。 2026-06-02のTIL で作成した関数をデプロイするテンプレートはこちら。 AWSTemplateFormatVersion: &#39;2010-09-09&#39; Description: Deploy Lambda for Step Functions start workflow. Parameters: StateMachineArn: Type: String Description: ARN of the Step Funct…</summary>
        <content type="html">&lt;p&gt;今日学んだことを雑多に書く。&lt;/p&gt;

&lt;h2 id=&quot;Lambda関数をCloudFormationでデプロイする&quot;&gt;Lambda関数をCloudFormationでデプロイする&lt;/h2&gt;

&lt;p&gt;Lambda 関数を CloudFormation でデプロイしたい。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.jhashimoto.net/entry/2026/06/02/201330&quot;&gt;2026-06-02のTIL&lt;/a&gt; で作成した関数をデプロイするテンプレートはこちら。&lt;/p&gt;

&lt;pre class=&quot;code lang-yaml&quot; data-lang=&quot;yaml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;AWSTemplateFormatVersion&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;&#39;2010-09-09&#39;&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; Deploy Lambda for Step Functions start workflow.

&lt;span class=&quot;synIdentifier&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;StateMachineArn&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; String
    &lt;span class=&quot;synIdentifier&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; ARN of the Step Functions state machine to start.

&lt;span class=&quot;synIdentifier&quot;&gt;Resources&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;StartStepFunctionLambdaExecutionRole&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; AWS::IAM::Role
    &lt;span class=&quot;synIdentifier&quot;&gt;Properties&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;synIdentifier&quot;&gt;AssumeRolePolicyDocument&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;synIdentifier&quot;&gt;Version&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;&#39;2012-10-17&#39;&lt;/span&gt;
        &lt;span class=&quot;synIdentifier&quot;&gt;Statement&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Effect&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; Allow
            &lt;span class=&quot;synIdentifier&quot;&gt;Principal&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
              &lt;span class=&quot;synIdentifier&quot;&gt;Service&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;lambda.amazonaws.com
            &lt;span class=&quot;synIdentifier&quot;&gt;Action&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
              &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;sts:AssumeRole
      &lt;span class=&quot;synIdentifier&quot;&gt;Path&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; /
      &lt;span class=&quot;synIdentifier&quot;&gt;ManagedPolicyArns&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
      &lt;span class=&quot;synIdentifier&quot;&gt;Policies&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;PolicyName&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; StartStepFunctionPolicy
          &lt;span class=&quot;synIdentifier&quot;&gt;PolicyDocument&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;synIdentifier&quot;&gt;Version&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;&#39;2012-10-17&#39;&lt;/span&gt;
            &lt;span class=&quot;synIdentifier&quot;&gt;Statement&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
              &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;Effect&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; Allow
                &lt;span class=&quot;synIdentifier&quot;&gt;Action&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
                  &lt;span class=&quot;synStatement&quot;&gt;- &lt;/span&gt;states:StartExecution
                &lt;span class=&quot;synIdentifier&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;!Ref&lt;/span&gt; StateMachineArn

  &lt;span class=&quot;synIdentifier&quot;&gt;StartStepFunctionLambda&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; AWS::Lambda::Function
    &lt;span class=&quot;synIdentifier&quot;&gt;Properties&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;synIdentifier&quot;&gt;FunctionName&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; StartStepFunctionLambda
      &lt;span class=&quot;synIdentifier&quot;&gt;Runtime&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; python3.14
      &lt;span class=&quot;synIdentifier&quot;&gt;Handler&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; index.lambda_handler
      &lt;span class=&quot;synIdentifier&quot;&gt;Role&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;!GetAtt&lt;/span&gt; StartStepFunctionLambdaExecutionRole.Arn
      &lt;span class=&quot;synIdentifier&quot;&gt;Timeout&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;60&lt;/span&gt;
      &lt;span class=&quot;synIdentifier&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;synIdentifier&quot;&gt;Variables&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;synIdentifier&quot;&gt;STATE_MACHINE_ARN&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;!Ref&lt;/span&gt; StateMachineArn
      &lt;span class=&quot;synIdentifier&quot;&gt;Code&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;synIdentifier&quot;&gt;ZipFile&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; |
          import boto3
          import json
          import os

          sfn = boto3.client(&#39;stepfunctions&#39;)

          STATE_MACHINE_ARN = os.environ[&#39;STATE_MACHINE_ARN&#39;]

          &lt;span class=&quot;synIdentifier&quot;&gt;def lambda_handler(event, context)&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
              input_payload = &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
                  &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;instanceType&amp;quot;&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; event&lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&#39;instanceType&#39;&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;,
                  &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;clusterId&amp;quot;&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; event&lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&#39;clusterId&#39;&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;,
              &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

              response = sfn.start_execution(
                  stateMachineArn=STATE_MACHINE_ARN,
                  input=json.dumps(input_payload)
              )

              return &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
                  &lt;span class=&quot;synConstant&quot;&gt;&#39;statusCode&#39;&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;200&lt;/span&gt;,
                  &lt;span class=&quot;synConstant&quot;&gt;&#39;executionArn&#39;&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; response&lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&#39;executionArn&#39;&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
              &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;synIdentifier&quot;&gt;Outputs&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;StartStepFunctionLambdaArn&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; ARN of the Step Functions start Lambda function
    &lt;span class=&quot;synIdentifier&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;!GetAtt&lt;/span&gt; StartStepFunctionLambda.Arn

  &lt;span class=&quot;synIdentifier&quot;&gt;StartStepFunctionLambdaName&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; Name of the Step Functions start Lambda function
    &lt;span class=&quot;synIdentifier&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;!Ref&lt;/span&gt; StartStepFunctionLambda
&lt;/pre&gt;

</content>        
        <category term="TIL" label="TIL" />
        
        <category term="CloudFormation" label="CloudFormation" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/14945776032039132715/1780662252" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Today I Learned - 2026-06-02</title>
        <link href="https://blog.jhashimoto.net/entry/2026/06/02/201330"/>
        <id>hatenablog://entry/14945776032038018876</id>
        <published>2026-06-02T20:13:30+09:00</published>
        <updated>2026-06-02T20:19:20+09:00</updated>        <summary type="html">Today I Learned (TIL) の投稿。今日学んだことを雑多に書く。 Lambda関数からステートマシンを起動する import boto3 import json import os sfn = boto3.client(&#39;stepfunctions&#39;) # 環境変数から取得 STATE_MACHINE_ARN = os.environ[&#39;STATE_MACHINE_ARN&#39;] def lambda_handler(event, context): # イベントからパラメータを受け取る input_payload = { &quot;instanceType&quot;: event[&#39;instan…</summary>
        <content type="html">&lt;p&gt;Today I Learned (TIL) の投稿。今日学んだことを雑多に書く。&lt;/p&gt;

&lt;h3 id=&quot;Lambda関数からステートマシンを起動する&quot;&gt;Lambda関数からステートマシンを起動する&lt;/h3&gt;

&lt;pre class=&quot;code lang-python&quot; data-lang=&quot;python&quot; data-unlink&gt;&lt;span class=&quot;synPreProc&quot;&gt;import&lt;/span&gt; boto3
&lt;span class=&quot;synPreProc&quot;&gt;import&lt;/span&gt; json
&lt;span class=&quot;synPreProc&quot;&gt;import&lt;/span&gt; os

sfn = boto3.client(&lt;span class=&quot;synConstant&quot;&gt;&#39;stepfunctions&#39;&lt;/span&gt;)

&lt;span class=&quot;synComment&quot;&gt;# 環境変数から取得&lt;/span&gt;
STATE_MACHINE_ARN = os.environ[&lt;span class=&quot;synConstant&quot;&gt;&#39;STATE_MACHINE_ARN&#39;&lt;/span&gt;]

&lt;span class=&quot;synStatement&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;lambda_handler&lt;/span&gt;(event, context):
    &lt;span class=&quot;synComment&quot;&gt;# イベントからパラメータを受け取る&lt;/span&gt;
    input_payload = {
        &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;instanceType&amp;quot;&lt;/span&gt;: event[&lt;span class=&quot;synConstant&quot;&gt;&#39;instanceType&#39;&lt;/span&gt;],
        &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;clusterId&amp;quot;&lt;/span&gt;: event[&lt;span class=&quot;synConstant&quot;&gt;&#39;clusterId&#39;&lt;/span&gt;],
        &lt;span class=&quot;synComment&quot;&gt;# その他の必要なパラメータ&lt;/span&gt;
        ... 
    }

    response = sfn.start_execution(
        stateMachineArn=STATE_MACHINE_ARN,
        &lt;span class=&quot;synIdentifier&quot;&gt;input&lt;/span&gt;=json.dumps(input_payload)
    )

    &lt;span class=&quot;synStatement&quot;&gt;return&lt;/span&gt; {
        &lt;span class=&quot;synConstant&quot;&gt;&#39;statusCode&#39;&lt;/span&gt;: &lt;span class=&quot;synConstant&quot;&gt;200&lt;/span&gt;,
        &lt;span class=&quot;synConstant&quot;&gt;&#39;executionArn&#39;&lt;/span&gt;: response[&lt;span class=&quot;synConstant&quot;&gt;&#39;executionArn&#39;&lt;/span&gt;]
    }
&lt;/pre&gt;


&lt;p&gt;Lambda 関数からステートマシンを起動するためには、Lambda 関数に適切な IAM ロールを割り当てる必要がある。以下は IAM ポリシーの例。&lt;/p&gt;

&lt;pre class=&quot;code lang-json&quot; data-lang=&quot;json&quot; data-unlink&gt;&lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  &amp;quot;&lt;span class=&quot;synStatement&quot;&gt;Effect&lt;/span&gt;&amp;quot;: &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;Allow&lt;/span&gt;&amp;quot;,
  &amp;quot;&lt;span class=&quot;synStatement&quot;&gt;Action&lt;/span&gt;&amp;quot;: &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;states:StartExecution&lt;/span&gt;&amp;quot;,
  &amp;quot;&lt;span class=&quot;synStatement&quot;&gt;Resource&lt;/span&gt;&amp;quot;: &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;arn:aws:states:ap-northeast-1:123456789:stateMachine:AddRdsReader&lt;/span&gt;&amp;quot;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;

</content>        
        <category term="TIL" label="TIL" />
        
        <category term="Lambda" label="Lambda" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/14945776032038018876/1780920059" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Today I Learned - 2026-05-31</title>
        <link href="https://blog.jhashimoto.net/entry/2026/06/01/074756"/>
        <id>hatenablog://entry/14945776032037238280</id>
        <published>2026-06-01T07:47:56+09:00</published>
        <updated>2026-06-01T08:04:06+09:00</updated>        <summary type="html">Today I Learned (TIL) の投稿。今日学んだことを雑多に書く。 壁紙のボールペン跡を落とす うっかりボールペンで壁紙を汚してしまった。 エタノールが効くらしい。 www.youtube.com たまたま自宅に消毒用エタノールがあったので、使ってみる。スプレーしたティッシュで叩いたら、綺麗に落ちた。 使ったのはこちら。 amzn.to</summary>
        <content type="html">&lt;p&gt;Today I Learned (TIL) の投稿。今日学んだことを雑多に書く。&lt;/p&gt;

&lt;h3 id=&quot;壁紙のボールペン跡を落とす&quot;&gt;壁紙のボールペン跡を落とす&lt;/h3&gt;

&lt;p&gt;うっかりボールペンで壁紙を汚してしまった。&lt;/p&gt;

&lt;p&gt;エタノールが効くらしい。&lt;/p&gt;

&lt;p&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/BsPC9ui5u-Y?feature=oembed&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&quot; referrerpolicy=&quot;strict-origin-when-cross-origin&quot; allowfullscreen title=&quot;【落ちすぎ】壁紙の油性ペンやボールペン、クレヨンの落書き跡を落とす方法これだ！&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=BsPC9ui5u-Y&quot;&gt;www.youtube.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;たまたま自宅に消毒用エタノールがあったので、使ってみる。スプレーしたティッシュで叩いたら、綺麗に落ちた。&lt;/p&gt;

&lt;p&gt;使ったのはこちら。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Famzn.to%2F4dFqsv1&quot; title=&quot;Amazon.co.jp: 【第3類医薬品】消毒用エタノールIP「ケンエー」(スプレー式) 500mL ×3 : ドラッグストア&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot; loading=&quot;lazy&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://amzn.to/4dFqsv1&quot;&gt;amzn.to&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="TIL" label="TIL" />
        
        <category term="ライフハック" label="ライフハック" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/14945776032037238280/1780920056" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Today I Learned - 2026-05-30</title>
        <link href="https://blog.jhashimoto.net/entry/2026/05/30/170355"/>
        <id>hatenablog://entry/14945776032036841151</id>
        <published>2026-05-30T17:03:55+09:00</published>
        <updated>2026-05-30T17:03:55+09:00</updated>        <summary type="html">朝活のもくもく会に参加した https://morimori.connpass.com/event/395025/ 週末は 8:00～9:30 開催。開始時にやること、終了時にやったことを投稿する。 時間を予約すると、それだけでメリハリがつく気がする。続けてみる。 先延ばしにしていた登壇スライドリポジトリの整備ができた。 https://github.com/JHashimoto0518/slide-deck/ 再起動なしでマウントしたい OS を再起動すると/etc/fstabを元にマウントされるが、再起動を避けたいケースがある。 # fstabに記述されているすべてのファイルシステムをマウ…</summary>
        <content type="html">&lt;h3 id=&quot;朝活のもくもく会に参加した&quot;&gt;朝活のもくもく会に参加した&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://morimori.connpass.com/event/395025/&quot;&gt;https://morimori.connpass.com/event/395025/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;週末は 8:00～9:30 開催。開始時にやること、終了時にやったことを投稿する。&lt;/p&gt;

&lt;p&gt;時間を予約すると、それだけでメリハリがつく気がする。続けてみる。&lt;/p&gt;

&lt;p&gt;先延ばしにしていた登壇スライドリポジトリの整備ができた。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/JHashimoto0518/slide-deck/&quot;&gt;https://github.com/JHashimoto0518/slide-deck/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;再起動なしでマウントしたい&quot;&gt;再起動なしでマウントしたい&lt;/h3&gt;

&lt;p&gt;OS を再起動すると&lt;code&gt;/etc/fstab&lt;/code&gt;を元にマウントされるが、再起動を避けたいケースがある。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;&lt;span class=&quot;synComment&quot;&gt;# fstabに記述されているすべてのファイルシステムをマウントする&lt;/span&gt;
sudo mount &lt;span class=&quot;synSpecial&quot;&gt;-a&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# 特定のエントリだけマウントする&lt;/span&gt;
sudo mount /mountpoint
&lt;/pre&gt;


&lt;h3 id=&quot;マウント先のEFSファイルシステムIDを確認する&quot;&gt;マウント先のEFSファイルシステムIDを確認する&lt;/h3&gt;

&lt;p&gt;複数の EFS ファイルシステムがある。誤ったファイルシステムをマウントしていないか確認したい。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;df&lt;/code&gt;の出力では EFS の接続先が 127.0.0.1 となり、ファイルシステム ID を確認できない。どうすればよいか？&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;df &lt;span class=&quot;synSpecial&quot;&gt;-h&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# 127.0.0.1:/path ... &lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;EFS マウントヘルパーが TLS マウント時に自動生成するファイルをみればよい。&lt;/p&gt;

&lt;p&gt;ファイルシステム ID が&lt;code&gt;fs-xxxxxxxxxxxxxx&lt;/code&gt;、マウントポイントが&lt;code&gt;/home/my-user/contents&lt;/code&gt;、トンネルのポートが&lt;code&gt;20000&lt;/code&gt;だとすると、以下のように出力される。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;sudo &lt;span class=&quot;synStatement&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;-1&lt;/span&gt; /var/run/efs/
&lt;span class=&quot;synComment&quot;&gt;# fs-xxxxxxxxxxxxxxx.home.my-user.contents.20000&lt;/span&gt;
&lt;/pre&gt;


&lt;h3 id=&quot;EFSの接続先が127001である理由&quot;&gt;EFSの接続先が127.0.0.1である理由&lt;/h3&gt;

&lt;p&gt;先に記載したとおり、EFS の接続先が 127.0.0.1 として出力される。Amazon Linux 2023 (AL2023) で確認。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;&lt;span class=&quot;synComment&quot;&gt;# AL2&lt;/span&gt;
fs-xxxxxxxxxxxxxx.efs.ap-northeast-1.amazonaws.com:/contents ... /home/my-user/contents
 
&lt;span class=&quot;synComment&quot;&gt;# AL2023&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;127&lt;/span&gt;.&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;.1:/contents ... /home/my-user/contents
&lt;/pre&gt;


&lt;p&gt;原因は Amazon Linux でサポートする amazon-efs-utils のバージョンアップ（1 系 → 2 系）の際に、デフォルトでのセキュリティ強化が入ったため。&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;amazon-efs-utils 2 系では、EFS マウント時にデフォルトで転送時暗号化が有効になる&lt;/li&gt;
&lt;li&gt;その場合、NFS クライアントは暗号化されたトンネル経由で EFS に接続するため、df コマンドでは接続先が 127.0.0.1 として表示される&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;参考: &lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/efs/latest/ug/encryption-in-transit.html&quot;&gt;https://docs.aws.amazon.com/ja_jp/efs/latest/ug/encryption-in-transit.html&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;EFS マウントヘルパーは、efs-proxy (efs-utils バージョン 2.0.0 以降) または stunnel (efs-utils の以前のバージョン) を使用して EFS ファイルシステムとの安全な TLS 接続を確立することでプロセスを管理します。&lt;/p&gt;&lt;/blockquote&gt;
</content>        
        <category term="TIL" label="TIL" />
        
        <category term="Linux" label="Linux" />
        
        <category term="EFS" label="EFS" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/14945776032036841151/1780920055" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Today I Learned - 2026-05-29</title>
        <link href="https://blog.jhashimoto.net/entry/2026/05/29/223440"/>
        <id>hatenablog://entry/14945776032036573093</id>
        <published>2026-05-29T22:34:40+09:00</published>
        <updated>2026-05-29T22:34:41+09:00</updated>        <summary type="html">はてなブログワークフローで記事を投稿する テンプレートリポジトリ: https://github.com/hatena/Hatena-Blog-Workflows-Boilerplate セットアップは省略。組織ではなく個人利用を想定。 下書きを作成する プルリクエストを作成する。 Actions から create draft を選択し、Titleに記事タイトルを設定、Branch: mainに対して実行する 作成した下書きを含むプルリクエストが作成される 下書きを含むブランチがリモートに作成される。ブランチ名は draft-entry-xxxxx という形式になっている。 ローカルで下書き…</summary>
        <content type="html">&lt;h3 id=&quot;はてなブログワークフローで記事を投稿する&quot;&gt;はてなブログワークフローで記事を投稿する&lt;/h3&gt;

&lt;p&gt;テンプレートリポジトリ: &lt;a href=&quot;https://github.com/hatena/Hatena-Blog-Workflows-Boilerplate&quot;&gt;https://github.com/hatena/Hatena-Blog-Workflows-Boilerplate&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;セットアップは省略。組織ではなく個人利用を想定。&lt;/p&gt;

&lt;h4 id=&quot;下書きを作成する&quot;&gt;下書きを作成する&lt;/h4&gt;

&lt;p&gt;プルリクエストを作成する。&lt;/p&gt;

&lt;blockquote&gt;&lt;ol&gt;
&lt;li&gt;Actions から create draft を選択し、Titleに記事タイトルを設定、Branch: mainに対して実行する&lt;/li&gt;
&lt;li&gt;作成した下書きを含むプルリクエストが作成される&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;下書きを含むブランチがリモートに作成される。ブランチ名は &lt;code&gt;draft-entry-xxxxx&lt;/code&gt; という形式になっている。&lt;/p&gt;

&lt;h4 id=&quot;ローカルで下書きを編集する&quot;&gt;ローカルで下書きを編集する&lt;/h4&gt;

&lt;p&gt;リモートの情報を取得してからスイッチする。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;git fetch origin
git switch draft-entry-xxxxx
&lt;/pre&gt;


&lt;h4 id=&quot;記事を公開する&quot;&gt;記事を公開する&lt;/h4&gt;

&lt;p&gt;下書きを編集したらフロントマターの&lt;code&gt;Draft: true&lt;/code&gt;を削除し、コミット、プッシュする。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;git push origin draft-entry-xxxxx
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;-u&lt;/code&gt; (&lt;code&gt;--set-upstream&lt;/code&gt;) で次回からブランチ指定を省略できる。マージ後にブランチは削除するので、今回はつけていない。&lt;/p&gt;

&lt;p&gt;プルリクエストを main ブランチにマージすると記事が公開される。&lt;/p&gt;

&lt;h3 id=&quot;はてなブログワークフローで既存記事を修正する&quot;&gt;はてなブログワークフローで既存記事を修正する&lt;/h3&gt;

&lt;p&gt;main ブランチに修正を直接プッシュしても、記事には反映されない。修正ブランチを main ブランチにマージする必要がある。&lt;/p&gt;

&lt;p&gt;修正ブランチを作成する。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;git switch &lt;span class=&quot;synSpecial&quot;&gt;-c&lt;/span&gt; fix/entry
&lt;/pre&gt;


&lt;p&gt;修正をコミットしたらプッシュする。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;git push origin fix/entry
&lt;/pre&gt;


&lt;p&gt;GitHub でプルリクエストを作成し、main にマージすると、記事に反映される。&lt;/p&gt;

&lt;h3 id=&quot;Linuxディストリビューションのバージョンを取り出す&quot;&gt;Linuxディストリビューションのバージョンを取り出す&lt;/h3&gt;

&lt;p&gt;ディストリビューションのバージョンを確認したい。&lt;/p&gt;

&lt;p&gt;Amazon Linux 2023 の例。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ &lt;span class=&quot;synStatement&quot;&gt;cat&lt;/span&gt; /etc/os-release | &lt;span class=&quot;synStatement&quot;&gt;grep&lt;/span&gt; PRETTY_NAME | cut &lt;span class=&quot;synSpecial&quot;&gt;-d&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&#39;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;-f&lt;/span&gt;2
&lt;span class=&quot;synComment&quot;&gt;# Amazon Linux 2023.7.20250331&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;元の出力は以下のようになっている。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ &lt;span class=&quot;synStatement&quot;&gt;cat&lt;/span&gt; /etc/os-release
&lt;span class=&quot;synComment&quot;&gt;# NAME=&amp;quot;Amazon Linux&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# VERSION=&amp;quot;2023&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# ID=&amp;quot;amzn&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# ID_LIKE=&amp;quot;fedora&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# VERSION_ID=&amp;quot;2023&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# PLATFORM_ID=&amp;quot;platform:al2023&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# PRETTY_NAME=&amp;quot;Amazon Linux 2023.7.20250331&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# ANSI_COLOR=&amp;quot;0;33&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# CPE_NAME=&amp;quot;cpe:2.3:o:amazon:amazon_linux:2023&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# HOME_URL=&amp;quot;https://aws.amazon.com/linux/amazon-linux-2023/&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# DOCUMENTATION_URL=&amp;quot;https://docs.aws.amazon.com/linux/&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# SUPPORT_URL=&amp;quot;https://aws.amazon.com/premiumsupport/&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# BUG_REPORT_URL=&amp;quot;https://github.com/amazonlinux/amazon-linux-2023&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# VENDOR_NAME=&amp;quot;AWS&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# VENDOR_URL=&amp;quot;https://aws.amazon.com/&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# SUPPORT_END=&amp;quot;2029-06-30&amp;quot;&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;なお、カーネルのバージョンを出力するには、以下のコマンドを使用する。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ uname &lt;span class=&quot;synSpecial&quot;&gt;-r&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# 6.12.20-23.97.amzn2023.x86_64&lt;/span&gt;
&lt;/pre&gt;


&lt;h3 id=&quot;Webサーバーを構成していないターゲットに対してALBのエンドポイントにリクエストして疎通確認する方法続き&quot;&gt;Webサーバーを構成していないターゲットに対してALBのエンドポイントにリクエストして疎通確認する方法（続き）&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.jhashimoto.net/entry/2026/05/29/085505&quot;&gt;til-2026-05-28&lt;/a&gt; のコードを再掲する。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;python3 &lt;span class=&quot;synSpecial&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;import http.server, socketserver&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;class Handler(http.server.BaseHTTPRequestHandler):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    def do_GET(self):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.send_response(200)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.end_headers()&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.wfile.write(b&#39;OK&#39;)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    def log_message(self, format, *args):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        pass  # ログ抑制&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;with socketserver.TCPServer((&#39;&#39;, 8443), Handler) as httpd:&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    httpd.serve_forever()&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;リッスンポートは環境依存なので、環境変数で渡すようにする。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;PORT&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;8443&lt;/span&gt; python3 &lt;span class=&quot;synSpecial&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;import http.server, socketserver, os&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;PORT = int(os.environ[&#39;PORT&#39;])&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;class Handler(http.server.BaseHTTPRequestHandler):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    def do_GET(self):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.send_response(200)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.end_headers()&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.wfile.write(b&#39;OK&#39;)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    def log_message(self, format, *args):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        pass  # ログ抑制&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;with socketserver.TCPServer((&#39;&#39;, PORT), Handler) as httpd:&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    print(f&#39;Listening on port {PORT}&#39;)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    httpd.serve_forever()&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;出力の際にプロンプトが改行されず見づらいので、末尾に改行を入れる。&lt;/p&gt;

&lt;pre class=&quot;code lang-diff&quot; data-lang=&quot;diff&quot; data-unlink&gt;PORT=8443 python3 -c &amp;quot;
import http.server, socketserver, os

PORT = int(os.environ[&#39;PORT&#39;])

class Handler(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.end_headers()
&lt;span class=&quot;synSpecial&quot;&gt;-        self.wfile.write(b&#39;OK&#39;)&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;+        self.wfile.write(b&#39;OK\n&#39;)&lt;/span&gt;
    def log_message(self, format, *args):
        pass  # ログ抑制

with socketserver.TCPServer((&#39;&#39;, PORT), Handler) as httpd:
    print(f&#39;Listening on port {PORT}&#39;)
    httpd.serve_forever()
&amp;quot;
&lt;/pre&gt;


&lt;h4 id=&quot;Ctrl--Cでエラーが出力される&quot;&gt;Ctrl + Cでエラーが出力される&lt;/h4&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;^CTraceback &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;most recent call last&lt;/span&gt;&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;:
  File &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;, line &lt;span class=&quot;synConstant&quot;&gt;16&lt;/span&gt;, &lt;span class=&quot;synError&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;lt;&lt;/span&gt;module&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt;
  File &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;/usr/lib64/python3.9/socketserver.py&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;, line &lt;span class=&quot;synConstant&quot;&gt;232&lt;/span&gt;, &lt;span class=&quot;synError&quot;&gt;in&lt;/span&gt; serve_forever
    ready &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; selector.select&lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;poll_interval&lt;/span&gt;&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
  File &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;/usr/lib64/python3.9/selectors.py&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;, line &lt;span class=&quot;synConstant&quot;&gt;416&lt;/span&gt;, &lt;span class=&quot;synError&quot;&gt;in&lt;/span&gt; select
    fd_event_list &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; self._selector.poll&lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;timeout&lt;/span&gt;&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
KeyboardInterrupt
&lt;/pre&gt;


&lt;p&gt;Ctrl+C による KeyboardInterrupt を Catch して、いったん解消した。あとで精査する。&lt;/p&gt;

&lt;pre class=&quot;code lang-diff&quot; data-lang=&quot;diff&quot; data-unlink&gt;with socketserver.TCPServer((&#39;&#39;, PORT), Handler) as httpd:
     print(f&#39;Listening on port {PORT}&#39;)
&lt;span class=&quot;synSpecial&quot;&gt;-    httpd.serve_forever()&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;+    try:&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;+        httpd.serve_forever()&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;+    except KeyboardInterrupt:&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;+        pass&lt;/span&gt;
 &amp;quot;
&lt;/pre&gt;


&lt;h4 id=&quot;Ctrl--Cで終了した直後に再度実行するとエラー終了する&quot;&gt;Ctrl + Cで終了した直後に再度実行するとエラー終了する&lt;/h4&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;Traceback &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;most recent call last&lt;/span&gt;&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;:
  File &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;, line &lt;span class=&quot;synConstant&quot;&gt;14&lt;/span&gt;, &lt;span class=&quot;synError&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;lt;&lt;/span&gt;module&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt;
  File &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;/usr/lib64/python3.9/socketserver.py&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;, line &lt;span class=&quot;synConstant&quot;&gt;452&lt;/span&gt;, &lt;span class=&quot;synError&quot;&gt;in&lt;/span&gt; __init__
    self.server_bind&lt;span class=&quot;synPreProc&quot;&gt;()&lt;/span&gt;
  File &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;/usr/lib64/python3.9/socketserver.py&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;, line &lt;span class=&quot;synConstant&quot;&gt;466&lt;/span&gt;, &lt;span class=&quot;synError&quot;&gt;in&lt;/span&gt; server_bind
    self.socket.bind&lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;self.server_address&lt;/span&gt;&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
OSError: &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;Errno &lt;span class=&quot;synConstant&quot;&gt;98&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt; Address already &lt;span class=&quot;synError&quot;&gt;in&lt;/span&gt; use
&lt;/pre&gt;


&lt;p&gt;使用中のポートへの再バインドで失敗している。&lt;code&gt;SO_REUSEADDR&lt;/code&gt; を有効にすると、TIME_WAIT 状態のソケットが残っていても同じポートにバインドできるようになる。&lt;/p&gt;

&lt;pre class=&quot;code lang-diff&quot; data-lang=&quot;diff&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;+socketserver.TCPServer.allow_reuse_address = True&lt;/span&gt;
 with socketserver.TCPServer((&#39;&#39;, PORT), Handler) as httpd:
     print(f&#39;Listening on port {PORT}&#39;)
     try:
         httpd.serve_forever()
     except KeyboardInterrupt:
         pass
&lt;/pre&gt;


&lt;p&gt;これらをすべて取り込んだ改良版。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;PORT&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;8443&lt;/span&gt; python3 &lt;span class=&quot;synSpecial&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;import http.server, socketserver, os&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;PORT = int(os.environ[&#39;PORT&#39;])&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;class Handler(http.server.BaseHTTPRequestHandler):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    def do_GET(self):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.send_response(200)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.end_headers()&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.wfile.write(b&#39;OK&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&#39;)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    def log_message(self, format, *args):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        pass&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;socketserver.TCPServer.allow_reuse_address = True&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;with socketserver.TCPServer((&#39;&#39;, PORT), Handler) as httpd:&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    print(f&#39;Listening on port {PORT}&#39;)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    try:&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        httpd.serve_forever()&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    except KeyboardInterrupt:&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        pass&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;/pre&gt;

</content>        
        <category term="TIL" label="TIL" />
        
        <category term="はてなブログワークフロー" label="はてなブログワークフロー" />
        
        <category term="Linux" label="Linux" />
        
        <category term="ALB" label="ALB" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/14945776032036573093/1780662516" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
    <entry>
        <title>Today I Learned - 2026-05-28</title>
        <link href="https://blog.jhashimoto.net/entry/2026/05/29/085505"/>
        <id>hatenablog://entry/14945776032036329958</id>
        <published>2026-05-29T08:55:05+09:00</published>
        <updated>2026-05-29T21:58:24+09:00</updated>        <summary type="html">til (Today I Learned) をブログに投稿する試み。 NLBを複数の踏み台サーバーのエンドポイントにしたい 現状 NLB がポート 22 でリッスンしている 転送先：踏み台サーバーA（ポート 22） 踏み台サーバーB にも転送したい 別ポートでリスナーを追加 リスナーポート ターゲットグループ (ポート) ターゲット (ポート) 22 ターゲットグループA（22） 踏み台サーバーA (22) 既存 2222 ターゲットグループB（22） 踏み台サーバーB (22) 新規 NLBのセキュリティグループで新しいリスナーポートを許可 NLB のセキュリティグループで、ポート 2222…</summary>
        <content type="html">&lt;p&gt;til (Today I Learned) をブログに投稿する試み。&lt;/p&gt;

&lt;h3 id=&quot;NLBを複数の踏み台サーバーのエンドポイントにしたい&quot;&gt;NLBを複数の踏み台サーバーのエンドポイントにしたい&lt;/h3&gt;

&lt;h4 id=&quot;現状&quot;&gt;現状&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;NLB がポート 22 でリッスンしている&lt;/li&gt;
&lt;li&gt;転送先：踏み台サーバーA（ポート 22）&lt;/li&gt;
&lt;li&gt;踏み台サーバーB にも転送したい&lt;/li&gt;
&lt;/ul&gt;


&lt;h4 id=&quot;別ポートでリスナーを追加&quot;&gt;別ポートでリスナーを追加&lt;/h4&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style=&quot;text-align:center;&quot;&gt; リスナーポート &lt;/th&gt;
&lt;th style=&quot;text-align:center;&quot;&gt; ターゲットグループ (ポート) &lt;/th&gt;
&lt;th style=&quot;text-align:center;&quot;&gt; ターゲット (ポート) &lt;/th&gt;
&lt;th style=&quot;text-align:center;&quot;&gt;  &lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center;&quot;&gt; &lt;code&gt;22&lt;/code&gt; &lt;/td&gt;
&lt;td style=&quot;text-align:center;&quot;&gt; ターゲットグループA（22） &lt;/td&gt;
&lt;td style=&quot;text-align:center;&quot;&gt; 踏み台サーバーA (22) &lt;/td&gt;
&lt;td style=&quot;text-align:center;&quot;&gt; 既存 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center;&quot;&gt; &lt;code&gt;2222&lt;/code&gt; &lt;/td&gt;
&lt;td style=&quot;text-align:center;&quot;&gt; ターゲットグループB（22） &lt;/td&gt;
&lt;td style=&quot;text-align:center;&quot;&gt; 踏み台サーバーB (22) &lt;/td&gt;
&lt;td style=&quot;text-align:center;&quot;&gt; &lt;strong&gt;新規&lt;/strong&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;h4 id=&quot;NLBのセキュリティグループで新しいリスナーポートを許可&quot;&gt;NLBのセキュリティグループで新しいリスナーポートを許可&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;NLB のセキュリティグループで、ポート &lt;code&gt;2222&lt;/code&gt; へのインバウンドルールを追加&lt;/li&gt;
&lt;li&gt;NLB がセキュリティグループをサポートする前に作成されたため、今回はセキュリティグループがなかった&lt;/li&gt;
&lt;/ul&gt;


&lt;h4 id=&quot;あとからセキュリティグループを関連付けることはできる&quot;&gt;あとからセキュリティグループを関連付けることはできる？&lt;/h4&gt;

&lt;p&gt;セキュリティグループを関連付けずに NLB を作成した場合、あとからセキュリティグループを関連付けることはできない。&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;セキュリティグループを関連付けずに Network Load Balancer を作成した場合、後でセキュリティグループを Network Load Balancer に関連付けることはできません。Network Load Balancer を作成するときに、セキュリティグループを Network Load Balancer に関連付けることをお勧めします。&lt;/p&gt;

&lt;p&gt;セキュリティグループを関連付けて Network Load Balancer を作成した後は、Network Load Balancer に関連付けられたセキュリティグループはいつでも変更できます。&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/elasticloadbalancing/latest/network/load-balancer-security-groups.html&quot;&gt;https://docs.aws.amazon.com/ja_jp/elasticloadbalancing/latest/network/load-balancer-security-groups.html&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;amazon-cloudwatch-agent-ctl&quot;&gt;amazon-cloudwatch-agent-ctl&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/AmazonCloudWatch/latest/monitoring/start-CloudWatch-Agent-on-premise-SSM-onprem.html&quot;&gt;https://docs.aws.amazon.com/ja_jp/AmazonCloudWatch/latest/monitoring/start-CloudWatch-Agent-on-premise-SSM-onprem.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;fetch-config アクションを使用して、設定を CloudWatch エージェントに適用できる。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl &lt;span class=&quot;synStatement&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;synSpecial&quot;&gt;-a&lt;/span&gt; fetch-config &lt;span class=&quot;synStatement&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;synSpecial&quot;&gt;-c&lt;/span&gt; file:/opt/aws/amazon-cloudwatch-agent/bin/config.json &lt;span class=&quot;synStatement&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;synSpecial&quot;&gt;-s&lt;/span&gt;
&lt;/pre&gt;


&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt; オプション &lt;/th&gt;
&lt;th&gt; 値 &lt;/th&gt;
&lt;th&gt; 意味 &lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt; &lt;code&gt;-a&lt;/code&gt; &lt;/td&gt;
&lt;td&gt; &lt;code&gt;fetch-config&lt;/code&gt; &lt;/td&gt;
&lt;td&gt; &lt;strong&gt;アクション&lt;/strong&gt;：設定を取得して適用する &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;code&gt;-c&lt;/code&gt; &lt;/td&gt;
&lt;td&gt; &lt;code&gt;file:/opt/...&lt;/code&gt; &lt;/td&gt;
&lt;td&gt; &lt;strong&gt;設定ソース&lt;/strong&gt;：どこから設定を読み込むか &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;code&gt;-s&lt;/code&gt; &lt;/td&gt;
&lt;td&gt; （値なし） &lt;/td&gt;
&lt;td&gt; &lt;strong&gt;Start&lt;/strong&gt;：設定適用後にエージェントを起動する &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;p&gt;-c オプションには、SSM パラメータストアも指定できる。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-c ssm:configuration-parameter-store-name&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;ターミナルからコピーペーストしてファイルを作成する際のバリデーション&quot;&gt;ターミナルからコピーペーストしてファイルを作成する際のバリデーション&lt;/h3&gt;

&lt;p&gt;セッションマネージャー (SSM) コンソールで疑似 SSH アクセスしている環境がある。&lt;/p&gt;

&lt;p&gt;SSM のターミナルではファイルコピーができないため、ターミナルからコンテンツをクリップボードにコピーし、WSL のターミナルにペーストしてファイルを作成した。&lt;/p&gt;

&lt;p&gt;双方のコンテンツ同一性を検証するにはファイルのハッシュ値を突き合わせるとよい。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;&lt;span class=&quot;synComment&quot;&gt;# SHA256&lt;/span&gt;
sha256sum filename
&lt;/pre&gt;


&lt;h3 id=&quot;Webサーバーを構成していないターゲットに対してALBのエンドポイントにリクエストして疎通確認する方法&quot;&gt;Webサーバーを構成していないターゲットに対してALBのエンドポイントにリクエストして疎通確認する方法&lt;/h3&gt;

&lt;p&gt;ここではインフラ観点での疎通確認を指す。Web サーバーなどのアプリケーションが構成されていないターゲットに対して、ALB のエンドポイントにリクエストしてターゲットへの疎通を確認する方法。&lt;/p&gt;

&lt;p&gt;以下の経路を想定する。&lt;/p&gt;

&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;ALB (HTTP:443) -&amp;gt; ターゲットグループ (HTTP:8443) -&amp;gt; ターゲット (HTTP:8443)&lt;/pre&gt;


&lt;p&gt;Python の組み込み HTTP サーバーを使用して、ターゲットで HTTP リクエストを受け付けるようにする。リクエストパスに関わらず常に 200 OK を返すので、ヘルスチェックパスを気にせずに疎通確認できる。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;python3 &lt;span class=&quot;synSpecial&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;import http.server, socketserver&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;class Handler(http.server.BaseHTTPRequestHandler):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    def do_GET(self):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.send_response(200)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.end_headers()&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        self.wfile.write(b&#39;OK&#39;)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    def log_message(self, format, *args):&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        pass  # ログ抑制&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;with socketserver.TCPServer((&#39;&#39;, 8443), Handler) as httpd:&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    httpd.serve_forever()&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;まず、ターゲットで HTTP サーバーを起動して、ローカルでリクエストしてみる。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;curl http://localhost:8443/my-health-check-path
&lt;span class=&quot;synComment&quot;&gt;# OK&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;次に、ターゲットグループのヘルスチェックで Unhealthy が Healthy に変わるのを確認する。&lt;/p&gt;

&lt;p&gt;なお、Healthy になるには、該当ターゲットグループを ALB に関連付ける必要があるので気を付けること。関連付けられていない場合は、ヘルスステータスは &lt;code&gt;Unused: Target group is not configured to receive trafficfrom the load balancer&lt;/code&gt; となる。&lt;/p&gt;

&lt;p&gt;Healthy になったら、ALB のエンドポイントにリクエストしてみる。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;curl https://alb-endpoint/
&lt;span class=&quot;synComment&quot;&gt;# OK&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;このときに ALB の DNS 名と証明書のドメイン名が一致していないため、証明書の検証エラーになるので注意。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;curl: &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt; SSL: no alternative certificate subject name matches target host name &lt;span class=&quot;synStatement&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;my-alb.ap-northeast-1.elb.amazonaws.com&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&#39;&lt;/span&gt;
More details here: https://curl.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
&lt;/pre&gt;


&lt;p&gt;疎通確認が目的なので、証明書の検証はスキップする。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;curl &lt;span class=&quot;synSpecial&quot;&gt;-k&lt;/span&gt; https://alb-endpoint/
&lt;span class=&quot;synComment&quot;&gt;# OK&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;または、ドメインに対してリクエストする。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;curl https://my-domain.com/
&lt;span class=&quot;synComment&quot;&gt;# OK&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;確認が終わったら、ターミナルで Ctrl + C して HTTP サーバーを停止する。&lt;/p&gt;
</content>        
        <category term="TIL" label="TIL" />
        
        <category term="NLB" label="NLB" />
        
        <category term="CloudWatch" label="CloudWatch" />
        
        <category term="ALB" label="ALB" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/14945776032036329958/1780920053" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>GitHub認証にGitHub CLIを利用するには</title>
        <link href="https://blog.jhashimoto.net/entry/2025/09/27/214132"/>
        <id>hatenablog://entry/6802888565257437733</id>
        <published>2025-09-27T21:41:32+09:00</published>
        <updated>2025-09-27T21:54:43+09:00</updated>        <summary type="html">コマンドラインから GitHub にアクセスする際に、認証する方法は複数あります。 GitHub CLI (gh) を使用しブラウザで認証すると、persnal access token の発行が不要になります。プロトコルは SSH も選べますが、今回は鍵の作成が不要な HTTPS を使用します。 環境 Ubuntu 24.04.3 LTS on WSL 手順 GitHub CLI (gh) をインストールします。 $ sudo apt update $ sudo apt install gh $ gh --version # gh version 2.45.0 (2025-07-18 Ubu…</summary>
        <content type="html">&lt;p&gt;コマンドラインから GitHub にアクセスする際に、認証する方法は複数あります。&lt;/p&gt;

&lt;p&gt;GitHub CLI (gh) を使用しブラウザで認証すると、persnal access token の発行が不要になります。プロトコルは SSH も選べますが、今回は鍵の作成が不要な HTTPS を使用します。&lt;/p&gt;

&lt;h3 id=&quot;環境&quot;&gt;環境&lt;/h3&gt;

&lt;p&gt;Ubuntu 24.04.3 LTS on WSL&lt;/p&gt;

&lt;h3 id=&quot;手順&quot;&gt;手順&lt;/h3&gt;

&lt;p&gt;GitHub CLI (gh) をインストールします。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ sudo apt update
$ sudo apt install gh                                                                                 
$ gh &lt;span class=&quot;synSpecial&quot;&gt;--version&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# gh version 2.45.0 (2025-07-18 Ubuntu 2.45.0-1ubuntu0.3)                                                                                                                      ```&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;gh auth login&lt;/code&gt; を実行し、以下のように入力します。ブラウザで提示された URL にアクセスし、認証コードを入力します。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ gh auth login
? What account &lt;span class=&quot;synStatement&quot;&gt;do&lt;/span&gt; you want to log into? GitHub.com
? What is your preferred protocol &lt;span class=&quot;synStatement&quot;&gt;for&lt;/span&gt; Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser
&lt;/pre&gt;


&lt;p&gt;gh が Git の credential helper として設定され、今後 git clone 等の際に認証が不要になります。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ git config &lt;span class=&quot;synSpecial&quot;&gt;--list&lt;/span&gt; | &lt;span class=&quot;synStatement&quot;&gt;grep&lt;/span&gt; credential
&lt;span class=&quot;synComment&quot;&gt;# credential.https://github.com.helper=&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# credential.https://github.com.helper=!/usr/bin/gh auth git-credential&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# credential.https://gist.github.com.helper=&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# credential.https://gist.github.com.helper=!/usr/bin/gh auth git-credential&lt;/span&gt;
&lt;/pre&gt;


&lt;h3 id=&quot;参考&quot;&gt;参考&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.github.com/ja/authentication/keeping-your-account-and-data-secure/about-authentication-to-github&quot;&gt;https://docs.github.com/ja/authentication/keeping-your-account-and-data-secure/about-authentication-to-github&lt;/a&gt;&lt;/p&gt;
</content>        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/6802888565257437733/1758977683" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>なぜKMSキーが割り当てられていないエイリアスが存在するのか？</title>
        <link href="https://blog.jhashimoto.net/entry/2024/09/03/083007"/>
        <id>hatenablog://entry/6802340630903437213</id>
        <published>2024-09-03T08:30:07+09:00</published>
        <updated>2024-09-03T08:30:07+09:00</updated>        <summary type="html">AWS CLI list-aliases のレスポンスに、TargetKeyId フィールドがないエイリアスが含まれていることがあります。 aws kms list-aliases { &quot;Aliases&quot;: [ { &quot;AliasName&quot;: &quot;alias/aws/codecommit&quot;, &quot;AliasArn&quot;: &quot;arn:aws:kms:ap-northeast-1:xxxxxxxxxxxx:alias/aws/codecommit&quot;, &quot;TargetKeyId&quot;: &quot;xxxx...&quot;, &quot;CreationDate&quot;: &quot;2024-06-17T00:34:07.222000+00:00&quot;, &quot;…</summary>
        <content type="html">&lt;p&gt;AWS CLI &lt;code&gt;list-aliases&lt;/code&gt; のレスポンスに、TargetKeyId フィールドがないエイリアスが含まれていることがあります。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;aws kms list-aliases
&lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Aliases&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;: &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;AliasName&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;: &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;alias/aws/codecommit&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;,
            &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;AliasArn&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;: &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;arn:aws:kms:ap-northeast-1:xxxxxxxxxxxx:alias/aws/codecommit&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;,
            &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;TargetKeyId&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;: &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;xxxx...&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;,
            &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;CreationDate&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;: &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;2024-06-17T00:34:07.222000+00:00&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;,
            &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;LastUpdatedDate&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;: &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;2024-06-17T00:34:07.222000+00:00&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;,
        &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;AliasName&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;: &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;alias/aws/dynamodb&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;,
            &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;AliasArn&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;: &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;arn:aws:kms:ap-northeast-1:xxxxxxxxxxxx:alias/aws/dynamodb&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;,
        ...
&lt;/pre&gt;


&lt;p&gt;なぜ、KMSキーが割り当てられていないエイリアスが存在するのか疑問に思い、調べてみました。&lt;/p&gt;

&lt;p&gt;これらは、AWS が作成した定義済みのエイリアスで、まだ KMS キーとは関連付けられていないものでした。これらの定義済みエイリアスは、通常、サービスの使用をスタートすると AWS 管理キーに関連付けられます。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdocs.aws.amazon.com%2Fja_jp%2Fkms%2Flatest%2Fdeveloperguide%2Fprogramming-aliases.html&quot; title=&quot;エイリアスの使用 - AWS Key Management Service&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot; loading=&quot;lazy&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/kms/latest/developerguide/programming-aliases.html&quot;&gt;docs.aws.amazon.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;レスポンスには、TargetKeyId フィールドがないエイリアスが含まれている場合もあります。これらは AWS が作成した定義済みのエイリアスですが、まだ KMS キーとは関連付けられていません。&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdocs.aws.amazon.com%2Fja_jp%2Fkms%2Flatest%2Fdeveloperguide%2Falias-about.html&quot; title=&quot;エイリアスについて - AWS Key Management Service&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot; loading=&quot;lazy&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/kms/latest/developerguide/alias-about.html&quot;&gt;docs.aws.amazon.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;一部の AWS エイリアスには KMS キーがありません。これらの定義済みエイリアスは、通常、サービスの使用をスタートすると、AWS マネージドキー に関連付けられます。&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;ちなみに、CreateAlias API は TargetKeyId が必須なので、KMS キーが割り当てられないエイリアスを作成することはできません。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdocs.aws.amazon.com%2Fja_jp%2Fkms%2Flatest%2FAPIReference%2FAPI_CreateAlias.html&quot; title=&quot;CreateAlias - AWS Key Management Service&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot; loading=&quot;lazy&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/kms/latest/APIReference/API_CreateAlias.html&quot;&gt;docs.aws.amazon.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="AWS" label="AWS" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/6802340630903437213/1725323567" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>2022年に買って良かったもの８選</title>
        <link href="https://blog.jhashimoto.net/entry/2022/12/31/195000"/>
        <id>hatenablog://entry/4207112889949766984</id>
        <published>2022-12-31T19:50:00+09:00</published>
        <updated>2022-12-31T10:50:00+09:00</updated>        <summary type="html">2022年に買って良かったものを厳選して紹介します。</summary>
        <content type="html">&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20221231/20221231202644.jpg&quot; width=&quot;640&quot; height=&quot;427&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;2022年に買って良かったものを厳選して紹介します。&lt;/p&gt;

&lt;h2 id=&quot;昇降式スタンディングデスク&quot;&gt;昇降式スタンディングデスク&lt;/h2&gt;

&lt;p&gt;腰痛を患ったので買いました。立って仕事をするようになり、腰の負担はかなり軽くなった気がします。&lt;/p&gt;

&lt;p&gt;普通のデスクに乗せて使用するタイプです。ほとんど力を入れずに昇降でき、無段階で高さを調整できます。キーボード、マウス、ディスプレイを置いていますが、十分な広さがあります。構造はしっかりしていて揺れを気にせずに打鍵できます。その分重量はかなりあります (7.8Kg) 。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;Fenge スタンディングデスク 昇降式デスク リフティングテーブル 高さ調整 PCデスク 小型 持ち運び 折りたたみ無段階座位立位両用オフィスワークテーブル SD255006WO&quot;,&quot;b&quot;:&quot;Fenge&quot;,&quot;t&quot;:&quot;SD255006WO&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/51rqECurDDL._SL500_.jpg&quot;,&quot;\/51ORwSKq6jL._SL500_.jpg&quot;,&quot;\/41WCQceU--L._SL500_.jpg&quot;,&quot;\/51GUQK7OV+L._SL500_.jpg&quot;,&quot;\/412hjHa5YtL._SL500_.jpg&quot;,&quot;\/51eszEiicmL._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B088LWSZXJ&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B088LWSZXJ&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/Fenge%20%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0%E3%83%87%E3%82%B9%E3%82%AF%20%E6%98%87%E9%99%8D%E5%BC%8F%E3%83%87%E3%82%B9%E3%82%AF%20%E3%83%AA%E3%83%95%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%20%E9%AB%98%E3%81%95%E8%AA%BF%E6%95%B4%20PC%E3%83%87%E3%82%B9%E3%82%AF%20%E5%B0%8F%E5%9E%8B%20%E6%8C%81%E3%81%A1%E9%81%8B%E3%81%B3%20%E6%8A%98%E3%82%8A%E3%81%9F%E3%81%9F%E3%81%BF%E7%84%A1%E6%AE%B5%E9%9A%8E%E5%BA%A7%E4%BD%8D%E7%AB%8B%E4%BD%8D%E4%B8%A1%E7%94%A8%E3%82%AA%E3%83%95%E3%82%A3%E3%82%B9%E3%83%AF%E3%83%BC%E3%82%AF%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%20SD255006WO\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=Fenge%20%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0%E3%83%87%E3%82%B9%E3%82%AF%20%E6%98%87%E9%99%8D%E5%BC%8F%E3%83%87%E3%82%B9%E3%82%AF%20%E3%83%AA%E3%83%95%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%20%E9%AB%98%E3%81%95%E8%AA%BF%E6%95%B4%20PC%E3%83%87%E3%82%B9%E3%82%AF%20%E5%B0%8F%E5%9E%8B%20%E6%8C%81%E3%81%A1%E9%81%8B%E3%81%B3%20%E6%8A%98%E3%82%8A%E3%81%9F%E3%81%9F%E3%81%BF%E7%84%A1%E6%AE%B5%E9%9A%8E%E5%BA%A7%E4%BD%8D%E7%AB%8B%E4%BD%8D%E4%B8%A1%E7%94%A8%E3%82%AA%E3%83%95%E3%82%A3%E3%82%B9%E3%83%AF%E3%83%BC%E3%82%AF%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%20SD255006WO&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;sV7QS&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-sV7QS&quot;&gt;リンク&lt;/div&gt;





&lt;h2 id=&quot;ノイズキャンセリングイヤーセット&quot;&gt;ノイズキャンセリングイヤーセット&lt;/h2&gt;

&lt;p&gt;ノイズキャンセリング付きです。以前からリモート会議中にPCの打鍵音がマイクに拾われていないか気になっていました。Zoomでテストしたところ、打鍵音は全く聞こえませんでした。高価なだけあって通話・音声は非常に安定しています。USBドングルを差し替えるだけで、複数デバイスで利用できます。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;Plantronics(プラトロニクス) Voyager 5200 UC イヤーセット&quot;,&quot;b&quot;:&quot;ポリー(Poly)&quot;,&quot;t&quot;:&quot;206110-01&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/31Nw4SFyO4L._SL500_.jpg&quot;,&quot;\/51pMFRlm7VL._SL500_.jpg&quot;,&quot;\/41EHg83Mn8L._SL500_.jpg&quot;,&quot;\/416OutE9L4L._SL500_.jpg&quot;,&quot;\/41EuqnU2I0L._SL500_.jpg&quot;,&quot;\/51omOUQjY-L._SL500_.jpg&quot;,&quot;\/41IBE7ub42L._SL500_.jpg&quot;,&quot;\/41wbNdE05WL._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B07DFQWGYB&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B07DFQWGYB&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/Plantronics(%E3%83%97%E3%83%A9%E3%83%88%E3%83%AD%E3%83%8B%E3%82%AF%E3%82%B9)%20Voyager%205200%20UC%20%E3%82%A4%E3%83%A4%E3%83%BC%E3%82%BB%E3%83%83%E3%83%88\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=Plantronics(%E3%83%97%E3%83%A9%E3%83%88%E3%83%AD%E3%83%8B%E3%82%AF%E3%82%B9)%20Voyager%205200%20UC%20%E3%82%A4%E3%83%A4%E3%83%BC%E3%82%BB%E3%83%83%E3%83%88&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;6TnDn&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-6TnDn&quot;&gt;リンク&lt;/div&gt;





&lt;p&gt;ケースがドッキングスタンドになっており、置くだけで充電できます。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.poly.com%2Fjp%2Fja%2Fproducts%2Fheadsets%2Faccessories%2Fvoyager-5200-charge-case&quot; title=&quot;Voyager 5200 充電ケース - 充電ケース&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot; loading=&quot;lazy&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://www.poly.com/jp/ja/products/headsets/accessories/voyager-5200-charge-case&quot;&gt;www.poly.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;尚、単体モデルはケースとUSBドングルが付属していないので、ご注意ください。&lt;/p&gt;

&lt;h2 id=&quot;コンパクトデジタルスケール&quot;&gt;コンパクトデジタルスケール&lt;/h2&gt;

&lt;p&gt;封筒の計量に使っています。郵便局まで計量に行くのが面倒で購入しました。コンパクトでよいです。カバーが測る物を載せる容器になるのも便利です。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;YUUICHI コンパクトデジタルスケール 0.1gから3000gまで計量可能 はかり デジタル 測り 料理 調理 お菓子作り 封筒 レタースケール 風袋引き 計量はかり 日本語取扱説明書付き　電池付き&quot;,&quot;b&quot;:&quot;YUUICHI&quot;,&quot;t&quot;:&quot;N\\C&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/41SNM2X7pXL._SL500_.jpg&quot;,&quot;\/41OILJ5BF2L._SL500_.jpg&quot;,&quot;\/51lda9ilXhL._SL500_.jpg&quot;,&quot;\/51G5AJReANL._SL500_.jpg&quot;,&quot;\/41dONBxjqXL._SL500_.jpg&quot;,&quot;\/41F9WVgVqCL._SL500_.jpg&quot;,&quot;\/41+sZXFkMUL._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B09XXWJY2L&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B09XXWJY2L&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/YUUICHI%20%E3%82%B3%E3%83%B3%E3%83%91%E3%82%AF%E3%83%88%E3%83%87%E3%82%B8%E3%82%BF%E3%83%AB%E3%82%B9%E3%82%B1%E3%83%BC%E3%83%AB%200.1g%E3%81%8B%E3%82%893000g%E3%81%BE%E3%81%A7%E8%A8%88%E9%87%8F%E5%8F%AF%E8%83%BD%20%E3%81%AF%E3%81%8B%E3%82%8A%20%E3%83%87%E3%82%B8%E3%82%BF%E3%83%AB%20%E6%B8%AC%E3%82%8A%20%E6%96%99%E7%90%86%20%E8%AA%BF%E7%90%86%20%E3%81%8A%E8%8F%93%E5%AD%90%E4%BD%9C%E3%82%8A%20%E5%B0%81%E7%AD%92%20%E3%83%AC%E3%82%BF%E3%83%BC%E3%82%B9%E3%82%B1%E3%83%BC%E3%83%AB%20%E9%A2%A8%E8%A2%8B%E5%BC%95%E3%81%8D%20%E8%A8%88%E9%87%8F%E3%81%AF%E3%81%8B%E3%82%8A%20%E6%97%A5%E6%9C%AC%E8%AA%9E%E5%8F%96%E6%89%B1%E8%AA%AC%E6%98%8E%E6%9B%B8%E4%BB%98%E3%81%8D%E3%80%80%E9%9B%BB%E6%B1%A0%E4%BB%98%E3%81%8D\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=YUUICHI%20%E3%82%B3%E3%83%B3%E3%83%91%E3%82%AF%E3%83%88%E3%83%87%E3%82%B8%E3%82%BF%E3%83%AB%E3%82%B9%E3%82%B1%E3%83%BC%E3%83%AB%200.1g%E3%81%8B%E3%82%893000g%E3%81%BE%E3%81%A7%E8%A8%88%E9%87%8F%E5%8F%AF%E8%83%BD%20%E3%81%AF%E3%81%8B%E3%82%8A%20%E3%83%87%E3%82%B8%E3%82%BF%E3%83%AB%20%E6%B8%AC%E3%82%8A%20%E6%96%99%E7%90%86%20%E8%AA%BF%E7%90%86%20%E3%81%8A%E8%8F%93%E5%AD%90%E4%BD%9C%E3%82%8A%20%E5%B0%81%E7%AD%92%20%E3%83%AC%E3%82%BF%E3%83%BC%E3%82%B9%E3%82%B1%E3%83%BC%E3%83%AB%20%E9%A2%A8%E8%A2%8B%E5%BC%95%E3%81%8D%20%E8%A8%88%E9%87%8F%E3%81%AF%E3%81%8B%E3%82%8A%20%E6%97%A5%E6%9C%AC%E8%AA%9E%E5%8F%96%E6%89%B1%E8%AA%AC%E6%98%8E%E6%9B%B8%E4%BB%98%E3%81%8D%E3%80%80%E9%9B%BB%E6%B1%A0%E4%BB%98%E3%81%8D&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;nneCv&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-nneCv&quot;&gt;リンク&lt;/div&gt;





&lt;h2 id=&quot;ダンボールストッカー&quot;&gt;ダンボールストッカー&lt;/h2&gt;

&lt;p&gt;洗面所の隙間にぴったり収まるサイズなので購入しました。景観を損なわずにダンボールを保管できます。&lt;/p&gt;

&lt;p&gt;保管したままダンボールを縛れるのも便利です。キャスター付きで移動できます。マグネットでカッターなどの小物をくっつけられます。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;ビーワーススタイル ダンボールストッカー fillete(フィレッテ) 段ボールストッカー (ダンボールストッカー ホワイト×グレー W120)&quot;,&quot;b&quot;:&quot;be worth style&quot;,&quot;t&quot;:&quot;&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/2155xoqI4DL._SL500_.jpg&quot;,&quot;\/41qoH3lTwIL._SL500_.jpg&quot;,&quot;\/41uQcWekkLL._SL500_.jpg&quot;,&quot;\/4114T8N49gL._SL500_.jpg&quot;,&quot;\/41cZQwk6Q5L._SL500_.jpg&quot;,&quot;\/31vb8bOpjSL._SL500_.jpg&quot;,&quot;\/4126QriaxpL._SL500_.jpg&quot;,&quot;\/31Rb5QXuj0L._SL500_.jpg&quot;,&quot;\/418OTIAZC1L._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B09MCH6R65&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B09MCH6R65&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/%E3%83%93%E3%83%BC%E3%83%AF%E3%83%BC%E3%82%B9%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AB%20%E3%83%80%E3%83%B3%E3%83%9C%E3%83%BC%E3%83%AB%E3%82%B9%E3%83%88%E3%83%83%E3%82%AB%E3%83%BC%20fillete(%E3%83%95%E3%82%A3%E3%83%AC%E3%83%83%E3%83%86)%20%E6%AE%B5%E3%83%9C%E3%83%BC%E3%83%AB%E3%82%B9%E3%83%88%E3%83%83%E3%82%AB%E3%83%BC%20(%E3%83%80%E3%83%B3%E3%83%9C%E3%83%BC%E3%83%AB%E3%82%B9%E3%83%88%E3%83%83%E3%82%AB%E3%83%BC%20%E3%83%9B%E3%83%AF%E3%82%A4%E3%83%88%C3%97%E3%82%B0%E3%83%AC%E3%83%BC%20W120)\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=%E3%83%93%E3%83%BC%E3%83%AF%E3%83%BC%E3%82%B9%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AB%20%E3%83%80%E3%83%B3%E3%83%9C%E3%83%BC%E3%83%AB%E3%82%B9%E3%83%88%E3%83%83%E3%82%AB%E3%83%BC%20fillete(%E3%83%95%E3%82%A3%E3%83%AC%E3%83%83%E3%83%86)%20%E6%AE%B5%E3%83%9C%E3%83%BC%E3%83%AB%E3%82%B9%E3%83%88%E3%83%83%E3%82%AB%E3%83%BC%20(%E3%83%80%E3%83%B3%E3%83%9C%E3%83%BC%E3%83%AB%E3%82%B9%E3%83%88%E3%83%83%E3%82%AB%E3%83%BC%20%E3%83%9B%E3%83%AF%E3%82%A4%E3%83%88%C3%97%E3%82%B0%E3%83%AC%E3%83%BC%20W120)&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;daB01&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-daB01&quot;&gt;リンク&lt;/div&gt;





&lt;h2 id=&quot;ダンボール開梱カッター&quot;&gt;ダンボール開梱カッター&lt;/h2&gt;

&lt;p&gt;ダンボールを簡単に開梱できます。700円で粘着テープを剥がすストレスから解放されました。ボタンを押したときだけロックが外れる安全設計です。マグネット付きなのでダンボールストッカーにくっつけています。&lt;/p&gt;

&lt;p&gt;レターオープナーとの二役でコスパがよいです。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;サンスター文具 レターオープナー 開梱カッター SHUTTO シュット ブラック S3720799&quot;,&quot;b&quot;:&quot;サンスター文具(Sun-Star Stationery)&quot;,&quot;t&quot;:&quot;S3720799&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/41dUN1am26L._SL500_.jpg&quot;,&quot;\/41PejMJH+dL._SL500_.jpg&quot;,&quot;\/41QqzFWmMhL._SL500_.jpg&quot;,&quot;\/512M-PRektL._SL500_.jpg&quot;,&quot;\/519xRMOUKtL._SL500_.jpg&quot;,&quot;\/41NC0Zq0lKL._SL500_.jpg&quot;,&quot;\/51bF7xetUyL._SL500_.jpg&quot;,&quot;\/41PjOgYEO5L._SL500_.jpg&quot;,&quot;\/31TqsXJXKBL._SL500_.jpg&quot;,&quot;\/41k7P-B2huL._SL500_.jpg&quot;,&quot;\/31OxmBSNSyL._SL500_.jpg&quot;,&quot;\/41ABbWkntvL._SL500_.jpg&quot;,&quot;\/312J-8+S3sL._SL500_.jpg&quot;,&quot;\/31+N1fbx+vL._SL500_.jpg&quot;,&quot;\/4181adeN1BL._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B09STL9DQG&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B09STL9DQG&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/%E3%82%B5%E3%83%B3%E3%82%B9%E3%82%BF%E3%83%BC%E6%96%87%E5%85%B7%20%E3%83%AC%E3%82%BF%E3%83%BC%E3%82%AA%E3%83%BC%E3%83%97%E3%83%8A%E3%83%BC%20%E9%96%8B%E6%A2%B1%E3%82%AB%E3%83%83%E3%82%BF%E3%83%BC%20SHUTTO%20%E3%82%B7%E3%83%A5%E3%83%83%E3%83%88%20%E3%83%96%E3%83%A9%E3%83%83%E3%82%AF%20S3720799\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=%E3%82%B5%E3%83%B3%E3%82%B9%E3%82%BF%E3%83%BC%E6%96%87%E5%85%B7%20%E3%83%AC%E3%82%BF%E3%83%BC%E3%82%AA%E3%83%BC%E3%83%97%E3%83%8A%E3%83%BC%20%E9%96%8B%E6%A2%B1%E3%82%AB%E3%83%83%E3%82%BF%E3%83%BC%20SHUTTO%20%E3%82%B7%E3%83%A5%E3%83%83%E3%83%88%20%E3%83%96%E3%83%A9%E3%83%83%E3%82%AF%20S3720799&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;rFjLV&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-rFjLV&quot;&gt;リンク&lt;/div&gt;





&lt;h2 id=&quot;ドアストッパー&quot;&gt;ドアストッパー&lt;/h2&gt;

&lt;p&gt;ネットスーパーをよく利用します。商品受け渡し中にドアを開放しておくのに使っています。強力なマグネットでドアをしっかり固定してくれます。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;ドアストッパー マグネット ネオガチット アイデア 便利&quot;,&quot;b&quot;:&quot;マクティー&quot;,&quot;t&quot;:&quot;007554742&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/41-snYtVirL._SL500_.jpg&quot;,&quot;\/51N+xWhkwHL._SL500_.jpg&quot;,&quot;\/31pawy4W4kL._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B008CH4MDY&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B008CH4MDY&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/%E3%83%89%E3%82%A2%E3%82%B9%E3%83%88%E3%83%83%E3%83%91%E3%83%BC%20%E3%83%9E%E3%82%B0%E3%83%8D%E3%83%83%E3%83%88%20%E3%83%8D%E3%82%AA%E3%82%AC%E3%83%81%E3%83%83%E3%83%88%20%E3%82%A2%E3%82%A4%E3%83%87%E3%82%A2%20%E4%BE%BF%E5%88%A9\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=%E3%83%89%E3%82%A2%E3%82%B9%E3%83%88%E3%83%83%E3%83%91%E3%83%BC%20%E3%83%9E%E3%82%B0%E3%83%8D%E3%83%83%E3%83%88%20%E3%83%8D%E3%82%AA%E3%82%AC%E3%83%81%E3%83%83%E3%83%88%20%E3%82%A2%E3%82%A4%E3%83%87%E3%82%A2%20%E4%BE%BF%E5%88%A9&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;4tOQN&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-4tOQN&quot;&gt;リンク&lt;/div&gt;





&lt;h2 id=&quot;Kindle-Oasis&quot;&gt;Kindle Oasis&lt;/h2&gt;

&lt;p&gt;就寝後にマンガを読むのに利用しています。iPhoneのKindleアプリでも読めますが、ブルーライトが気になるので購入しました。反応の遅さが少し気になりますが、概ね満足しています。&lt;/p&gt;

&lt;p&gt;Oasisは購入当時の最上位モデルで、ページ送りボタンとディスプレイサイズを理由に選びました。広告なしモデルを選んで正解でした。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;Kindle Oasis 色調調節ライト搭載 wifi+4G 32GB 電子書籍リーダー&quot;,&quot;b&quot;:&quot;Amazon&quot;,&quot;t&quot;:&quot;53-015865&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/41Y+N+ZHOvL._SL500_.jpg&quot;,&quot;\/514HLx2qc0L._SL500_.jpg&quot;,&quot;\/41AKedyOt4S._SL500_.jpg&quot;,&quot;\/41X5VWm4G3L._SL500_.jpg&quot;,&quot;\/51343mEk1hL._SL500_.jpg&quot;,&quot;\/5186+K31ESL._SL500_.jpg&quot;,&quot;\/41jSwklYHsL._SL500_.jpg&quot;,&quot;\/41kn9w395SL._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B07GM846NR&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B07GM846NR&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/Kindle%20Oasis%20%E8%89%B2%E8%AA%BF%E8%AA%BF%E7%AF%80%E3%83%A9%E3%82%A4%E3%83%88%E6%90%AD%E8%BC%89%20wifi%2B4G%2032GB%20%E9%9B%BB%E5%AD%90%E6%9B%B8%E7%B1%8D%E3%83%AA%E3%83%BC%E3%83%80%E3%83%BC\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=Kindle%20Oasis%20%E8%89%B2%E8%AA%BF%E8%AA%BF%E7%AF%80%E3%83%A9%E3%82%A4%E3%83%88%E6%90%AD%E8%BC%89%20wifi%2B4G%2032GB%20%E9%9B%BB%E5%AD%90%E6%9B%B8%E7%B1%8D%E3%83%AA%E3%83%BC%E3%83%80%E3%83%BC&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;UwKyu&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-UwKyu&quot;&gt;リンク&lt;/div&gt;





&lt;p&gt;カバーも同時に購入しました。指を通すバンドが付属しており落下を防げます。私は電車の中でも読むので、このカバーが必須です。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;電子書籍リーダー保護カバー Kindle Oasis カバー （2019年 第10世代 \/ 2017年 第9世代）電子書籍リーダー専用PU革製保護ケース H01 – パープル&quot;,&quot;b&quot;:&quot;TECHRAME&quot;,&quot;t&quot;:&quot;JP-CaseKO-H01-Fuschia&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/51Xy07Kea4L._SL500_.jpg&quot;,&quot;\/51UtXAPlqWL._SL500_.jpg&quot;,&quot;\/314jwLH3n8S._SL500_.jpg&quot;,&quot;\/41V7RWUwWZL._SL500_.jpg&quot;,&quot;\/41zf-kuvkhL._SL500_.jpg&quot;,&quot;\/51Gqd0MC44L._SL500_.jpg&quot;,&quot;\/51D2LmGc1cL._SL500_.jpg&quot;,&quot;\/41hsUYIL16L._SL500_.jpg&quot;,&quot;\/411lkbYCVVL._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B08XNN5F3N&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B08XNN5F3N&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/%E9%9B%BB%E5%AD%90%E6%9B%B8%E7%B1%8D%E3%83%AA%E3%83%BC%E3%83%80%E3%83%BC%E4%BF%9D%E8%AD%B7%E3%82%AB%E3%83%90%E3%83%BC%20Kindle%20Oasis%20%E3%82%AB%E3%83%90%E3%83%BC%20%EF%BC%882019%E5%B9%B4%20%E7%AC%AC10%E4%B8%96%E4%BB%A3%20%2F%202017%E5%B9%B4%20%E7%AC%AC9%E4%B8%96%E4%BB%A3%EF%BC%89%E9%9B%BB%E5%AD%90%E6%9B%B8%E7%B1%8D%E3%83%AA%E3%83%BC%E3%83%80%E3%83%BC%E5%B0%82%E7%94%A8PU%E9%9D%A9%E8%A3%BD%E4%BF%9D%E8%AD%B7%E3%82%B1%E3%83%BC%E3%82%B9%20H01%20%E2%80%93%20%E3%83%91%E3%83%BC%E3%83%97%E3%83%AB\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=%E9%9B%BB%E5%AD%90%E6%9B%B8%E7%B1%8D%E3%83%AA%E3%83%BC%E3%83%80%E3%83%BC%E4%BF%9D%E8%AD%B7%E3%82%AB%E3%83%90%E3%83%BC%20Kindle%20Oasis%20%E3%82%AB%E3%83%90%E3%83%BC%20%EF%BC%882019%E5%B9%B4%20%E7%AC%AC10%E4%B8%96%E4%BB%A3%20%2F%202017%E5%B9%B4%20%E7%AC%AC9%E4%B8%96%E4%BB%A3%EF%BC%89%E9%9B%BB%E5%AD%90%E6%9B%B8%E7%B1%8D%E3%83%AA%E3%83%BC%E3%83%80%E3%83%BC%E5%B0%82%E7%94%A8PU%E9%9D%A9%E8%A3%BD%E4%BF%9D%E8%AD%B7%E3%82%B1%E3%83%BC%E3%82%B9%20H01%20%E2%80%93%20%E3%83%91%E3%83%BC%E3%83%97%E3%83%AB&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;K2Gtz&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-K2Gtz&quot;&gt;リンク&lt;/div&gt;





&lt;h2 id=&quot;Apple-Watch-Series-7&quot;&gt;Apple Watch Series 7&lt;/h2&gt;

&lt;p&gt;ジョギングにRunKeeperを使っています。ジョギングにiPhoneを携帯するのが煩わしく、Apple Watchを購入しました。&lt;/p&gt;

&lt;p&gt;また、つい仕事に集中し過ぎてしまう自分にとっては、一定時間座り続けていると「スタンドの時間です！ 立ち上がって1分間ほど動きましょう」とリマインドしてくれる機能がよいです。&lt;/p&gt;




&lt;script type=&quot;text/javascript&quot;&gt;
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName(&quot;body&quot;)[0],e.appendChild(d))})
(window,document,&quot;script&quot;,&quot;//dn.msmstatic.com/site/cardlink/bundle.js?20220329&quot;,&quot;msmaflink&quot;);
msmaflink({&quot;n&quot;:&quot;Apple Watch Series 7 (GPS + Cellularモデル) - 45mm グリーンアルミニウムケース - バンド無し (整備済み品)&quot;,&quot;b&quot;:&quot;Apple(アップル)&quot;,&quot;t&quot;:&quot;&quot;,&quot;d&quot;:&quot;https:\/\/m.media-amazon.com&quot;,&quot;c_p&quot;:&quot;\/images\/I&quot;,&quot;p&quot;:[&quot;\/31g0JI9LU6L._SL500_.jpg&quot;,&quot;\/514OUi1RrzS._SL500_.jpg&quot;,&quot;\/41366VTTgJL._SL500_.jpg&quot;],&quot;u&quot;:{&quot;u&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B0BGMT2XCJ&quot;,&quot;t&quot;:&quot;amazon&quot;,&quot;r_v&quot;:&quot;&quot;},&quot;v&quot;:&quot;2.1&quot;,&quot;b_l&quot;:[{&quot;id&quot;:1,&quot;u_tx&quot;:&quot;Amazonで見る&quot;,&quot;u_bc&quot;:&quot;#f79256&quot;,&quot;u_url&quot;:&quot;https:\/\/www.amazon.co.jp\/dp\/B0BGMT2XCJ&quot;,&quot;a_id&quot;:119719,&quot;p_id&quot;:170,&quot;pl_id&quot;:27060,&quot;pc_id&quot;:185,&quot;s_n&quot;:&quot;amazon&quot;,&quot;u_so&quot;:1},{&quot;id&quot;:2,&quot;u_tx&quot;:&quot;楽天市場で見る&quot;,&quot;u_bc&quot;:&quot;#f76956&quot;,&quot;u_url&quot;:&quot;https:\/\/search.rakuten.co.jp\/search\/mall\/Apple%20Watch%20Series%207%20(GPS%20%2B%20Cellular%E3%83%A2%E3%83%87%E3%83%AB)%20-%2045mm%20%E3%82%B0%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%A2%E3%83%AB%E3%83%9F%E3%83%8B%E3%82%A6%E3%83%A0%E3%82%B1%E3%83%BC%E3%82%B9%20-%20%E3%83%90%E3%83%B3%E3%83%89%E7%84%A1%E3%81%97%20(%E6%95%B4%E5%82%99%E6%B8%88%E3%81%BF%E5%93%81)\/&quot;,&quot;a_id&quot;:119718,&quot;p_id&quot;:54,&quot;pl_id&quot;:27059,&quot;pc_id&quot;:54,&quot;s_n&quot;:&quot;rakuten&quot;,&quot;u_so&quot;:2},{&quot;id&quot;:3,&quot;u_tx&quot;:&quot;Yahoo!ショッピングで見る&quot;,&quot;u_bc&quot;:&quot;#66a7ff&quot;,&quot;u_url&quot;:&quot;https:\/\/shopping.yahoo.co.jp\/search?first=1\u0026p=Apple%20Watch%20Series%207%20(GPS%20%2B%20Cellular%E3%83%A2%E3%83%87%E3%83%AB)%20-%2045mm%20%E3%82%B0%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%A2%E3%83%AB%E3%83%9F%E3%83%8B%E3%82%A6%E3%83%A0%E3%82%B1%E3%83%BC%E3%82%B9%20-%20%E3%83%90%E3%83%B3%E3%83%89%E7%84%A1%E3%81%97%20(%E6%95%B4%E5%82%99%E6%B8%88%E3%81%BF%E5%93%81)&quot;,&quot;a_id&quot;:3758086,&quot;p_id&quot;:1225,&quot;pl_id&quot;:27061,&quot;pc_id&quot;:1925,&quot;s_n&quot;:&quot;yahoo&quot;,&quot;u_so&quot;:3}],&quot;eid&quot;:&quot;veGHb&quot;,&quot;s&quot;:&quot;s&quot;});
&lt;/script&gt;


&lt;div id=&quot;msmaflink-veGHb&quot;&gt;リンク&lt;/div&gt;







&lt;div class=&quot;pochireba&quot; style=&quot;text-align:left;font-size:small;padding:20px 0;zoom: 1;overflow: hidden;&quot;&gt;&lt;a href=&quot;https://apps.apple.com/jp/app/asics-runkeeper-%E3%83%A9%E3%83%B3%E3%83%8B%E3%83%B3%E3%82%B0%E3%82%A2%E3%83%97%E3%83%AA/id300235330?uo=4&amp;at=10lrC7&quot; target=&quot;_blank&quot; &gt;&lt;img src=&quot;https://is5-ssl.mzstatic.com/image/thumb/Purple112/v4/01/f2/a6/01f2a680-8edd-708e-c687-c5bcb81dbaec/AppIcon-1x_U007emarketing-0-5-0-85-220.png/60x60bb.jpg&quot; alt=&quot;ASICS Runkeeper: ランニングアプリ&quot; width=&quot;60&quot; height=&quot;60&quot; style=&quot;float:left;margin:0 15px 0 0;width:60px;height:60px;&quot; class=&quot;pochi_img&quot; &gt;&lt;/a&gt;&lt;div class=&quot;pochi_info&quot; style=&quot;text-align:left;zoom: 1;overflow: hidden;&quot;&gt;&lt;div class=&quot;pochi_name&quot;&gt;&lt;a href=&quot;https://apps.apple.com/jp/app/asics-runkeeper-%E3%83%A9%E3%83%B3%E3%83%8B%E3%83%B3%E3%82%B0%E3%82%A2%E3%83%97%E3%83%AA/id300235330?uo=4&amp;at=10lrC7&quot; target=&quot;_blank&quot; &gt;ASICS Runkeeper: ランニングアプリ&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;pochi_price&quot; style=&quot;display:inline;&quot;&gt;無料&lt;/div&gt;&lt;div class=&quot;pochi_time&quot; style=&quot;font-size:x-small;display:inline;&quot;&gt;(2022.12.31時点)&lt;/div&gt;&amp;nbsp;&lt;a href=&quot;https://apps.apple.com/jp/app/asics-runkeeper-%E3%83%A9%E3%83%B3%E3%83%8B%E3%83%B3%E3%82%B0%E3%82%A2%E3%83%97%E3%83%AA/id300235330?uo=4&amp;at=10lrC7&quot; style=&quot;width:60px;color:#ffffff;background:#000000;font-size:8px;font-weight:bold;text-align:center;display:inline;text-decoration:none;border:0px;padding:2px;border-radius:5px;white-space:nowrap;&quot; target=&quot;_blank&quot; &gt;App Store&lt;/a&gt;&lt;div class=&quot;pochi_seller&quot;&gt;&lt;a href=&quot;https://apps.apple.com/jp/developer/fitnesskeeper-inc/id300226026?uo=4&amp;at=10lrC7&quot; target=&quot;_blank&quot; &gt;FitnessKeeper, Inc.&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;pochi_post&quot; style=&quot;font-size:x-small;&quot;&gt;posted with &lt;a href=&quot;http://pochireba.com&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;ポチレバ&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;pochireba-footer&quot; style=&quot;clear: left&quot;&gt;&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;一昨年の開業で立て込んでいたこともありアウトプットが滞ってましたが、2023年はブログの再開に本腰を入れたいと思います。ではよいお年を。&lt;/p&gt;
</content>        
        <category term="買い物" label="買い物" />
        
        <category term="ライフハック" label="ライフハック" />
        
        <link rel="enclosure" href="https://cdn.image.st-hatena.com/image/scale/735c8ae4068bc899aad8f350dab4c72bdb985673/backend=imagemagick;version=1;width=1300/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1561715276-a2d087060f1d%3Fixlib%3Drb-4.0.3%26ixid%3DMnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8%26auto%3Dformat%26fit%3Dcrop%26w%3D2070%26q%3D80" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>【Terraform】movedブロックでmoduleをリファクタリングする</title>
        <link href="https://blog.jhashimoto.net/entry/2022/05/08/192946"/>
        <id>hatenablog://entry/13574176438090501137</id>
        <published>2022-05-08T19:29:46+09:00</published>
        <updated>2022-05-08T10:29:46+09:00</updated>        <summary type="html">movedブロックはTerraform1.1で導入された新機能です。moduleのリファクタリングに使えるか検証しました。</summary>
        <content type="html">&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20220508/20220508192237.png&quot; width=&quot;1200&quot; height=&quot;424&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;moved&lt;/code&gt;ブロックはTerraform1.1で導入された新機能です。moduleのリファクタリングに使えるか検証しました。&lt;/p&gt;

&lt;h2&gt;実行環境&lt;/h2&gt;

&lt;p&gt;ubuntu-20.04 on Windows 10 (WSL2)&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform &lt;span class=&quot;synSpecial&quot;&gt;--version&lt;/span&gt;
Terraform v1.&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;.&lt;span class=&quot;synConstant&quot;&gt;9&lt;/span&gt;
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v3.&lt;span class=&quot;synConstant&quot;&gt;55&lt;/span&gt;.&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;
&lt;/pre&gt;


&lt;h2&gt;コード&lt;/h2&gt;

&lt;p&gt;準備したコードです。事前にapplyまで済ませてあります。&lt;/p&gt;

&lt;h3&gt;modules/vpc/variables.tf&lt;/h3&gt;

&lt;pre class=&quot;code lang-tf&quot; data-lang=&quot;tf&quot; data-unlink&gt;variable &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;vpc_name&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  type &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; string
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

variable &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;vpc_cidr&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  type &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; string
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

variable &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  type &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;(&lt;/span&gt;object&lt;span class=&quot;synSpecial&quot;&gt;({&lt;/span&gt;
    name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; string
    cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; string
  &lt;span class=&quot;synSpecial&quot;&gt;}))&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;h3&gt;modules/vpc/main.tf&lt;/h3&gt;

&lt;pre class=&quot;code lang-tf&quot; data-lang=&quot;tf&quot; data-unlink&gt;resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_vpc&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;this&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  cidr_block  &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; var.vpc_cidr
  tags        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; Name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; var.vpc_name &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_subnet&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;pub&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  for_each &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;for&lt;/span&gt; i in var.subnet &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt; i.name &lt;span class=&quot;synStatement&quot;&gt;=&amp;gt;&lt;/span&gt; i &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
  vpc_id      &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.this.id
  cidr_block  &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; each.value.cidr
  tags        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; Name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; each.value.name &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

output &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;vpc_id&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  value &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.this.id
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;h3&gt;main.tf&lt;/h3&gt;

&lt;pre class=&quot;code lang-tf&quot; data-lang=&quot;tf&quot; data-unlink&gt;module &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  source &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;../modules/vpc&lt;/span&gt;&amp;quot;

  vpc_name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;vpc-sample&lt;/span&gt;&amp;quot;
  vpc_cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;172.16.0.0/16&lt;/span&gt;&amp;quot;
  subnet &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
      name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&amp;quot;
      cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;172.16.0.0/20&lt;/span&gt;&amp;quot;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;,
    &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
      name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&amp;quot;
      cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;172.16.16.0/20&lt;/span&gt;&amp;quot;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;synStatement&quot;&gt;/&lt;/span&gt;/ moduleを使わない
resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;this&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  name        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;securitygroup-sample1&lt;/span&gt;&amp;quot;
  vpc_id      &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; module.vpc.vpc_id
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;h2&gt;moduleを使わないリソースのリネーム&lt;/h2&gt;

&lt;p&gt;まずmoduleを使わず定義したリソースで試します。&lt;/p&gt;

&lt;p&gt;セキュリティグループのリソース名を&lt;code&gt;default&lt;/code&gt;に変更します。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;diff &lt;span class=&quot;synSpecial&quot;&gt;--git&lt;/span&gt; a/vpc_sample/main.tf b/vpc_sample/main.tf
index 6b09809..bfa4756 &lt;span class=&quot;synConstant&quot;&gt;100755&lt;/span&gt;
--- a/vpc_sample/main.tf
+++ b/vpc_sample/main.tf
@@ &lt;span class=&quot;synConstant&quot;&gt;-15&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;7&lt;/span&gt; +&lt;span class=&quot;synConstant&quot;&gt;15&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;7&lt;/span&gt; @@ module &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
   ]
 &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

-resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
+resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
   name        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;securitygroup-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
   vpc_id      &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; module.vpc.vpc_id
 &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;当然ですが、リソースを作り直すplanが出力されます。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform plan
aws_security_group.this: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;sg&lt;/span&gt;-02a601a6be35932e4&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_vpc.this: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;-0c91c8c5673d89ee5&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-01629b6f8717a5523&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-0edf4b9618cf8f38f&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create
  - destroy

Terraform will perform the following actions:

  &lt;span class=&quot;synComment&quot;&gt;# aws_security_group.default will be created&lt;/span&gt;
  + resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
      + arn                    &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;known after apply&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
      + description            &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Managed by Terraform&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
      + egress                 &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;known after apply&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
      + id                     &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;known after apply&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
      + ingress                &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;known after apply&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
      + name                   &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;securitygroup-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
      + name_prefix            &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;known after apply&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
      + owner_id               &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;known after apply&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
      + revoke_rules_on_delete &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;false&lt;/span&gt;
      + tags_all               &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synPreProc&quot;&gt;(&lt;/span&gt;known after apply&lt;span class=&quot;synPreProc&quot;&gt;)&lt;/span&gt;
      + vpc_id                 &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc-0c91c8c5673d89ee5&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;synComment&quot;&gt;# aws_security_group.this will be destroyed&lt;/span&gt;
  &lt;span class=&quot;synComment&quot;&gt;# (because aws_security_group.this is not in configuration)&lt;/span&gt;
  - resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
      - arn                    &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;arn:aws:ec2:ap-northeast-1:601660378746:security-group/sg-02a601a6be35932e4&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - description            &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Managed by Terraform&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - egress                 &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;[]&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - id                     &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;sg-02a601a6be35932e4&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - ingress                &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;[]&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - name                   &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;securitygroup-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - owner_id               &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;601660378746&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - revoke_rules_on_delete &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;false&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - tags                   &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{}&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - tags_all               &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{}&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
      - vpc_id                 &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc-0c91c8c5673d89ee5&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; null
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

Plan: &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; to add, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to change, &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; to destroy.
&lt;/pre&gt;


&lt;p&gt;これを避けるには、従来は&lt;code&gt;terraform state mv&lt;/code&gt;でリソース名をリネームする必要がありました。Terraform 1.1からはmovedブロックが利用できます。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdev.classmethod.jp%2Farticles%2Fterraform-1-1-generally-available%2F&quot; title=&quot;Terraform のVersion 1.1がGAになりました | DevelopersIO&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://dev.classmethod.jp/articles/terraform-1-1-generally-available/&quot;&gt;dev.classmethod.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;movedブロックを追加して、再度planを実行してみます。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ git diff
diff &lt;span class=&quot;synSpecial&quot;&gt;--git&lt;/span&gt; a/vpc_sample/main.tf b/vpc_sample/main.tf
index 6b09809..2cb6d0b &lt;span class=&quot;synConstant&quot;&gt;100755&lt;/span&gt;
--- a/vpc_sample/main.tf
+++ b/vpc_sample/main.tf
@@ &lt;span class=&quot;synConstant&quot;&gt;-15&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;7&lt;/span&gt; +&lt;span class=&quot;synConstant&quot;&gt;15&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;13&lt;/span&gt; @@ module &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
   ]
 &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

-resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
+resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
   name        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;securitygroup-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
   vpc_id      &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; module.vpc.vpc_id
-&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
\ No newline at end of file
+&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
+
+moved &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
+  from &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_security_group.this
+  to &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_security_group.default
+&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;




&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform plan
module.vpc.aws_vpc.this: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;-0c91c8c5673d89ee5&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
aws_security_group.default: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;sg&lt;/span&gt;-02a601a6be35932e4&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-01629b6f8717a5523&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-0edf4b9618cf8f38f&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;

Terraform will perform the following actions:

  &lt;span class=&quot;synComment&quot;&gt;# aws_security_group.this has moved to aws_security_group.default&lt;/span&gt;
    resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
        id                     &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;sg-02a601a6be35932e4&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        name                   &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;securitygroup-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        tags                   &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{}&lt;/span&gt;
        &lt;span class=&quot;synComment&quot;&gt;# (8 unchanged attributes hidden)&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

Plan: &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to add, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to change, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to destroy.
&lt;/pre&gt;


&lt;p&gt;今度はリソース名をリネームするplanが出力されました。&lt;code&gt;add&lt;/code&gt;/&lt;code&gt;destroy&lt;/code&gt;が0であることを確認して、applyします。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform apply
...
Apply &lt;span class=&quot;synStatement&quot;&gt;complete&lt;/span&gt;! Resources: &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; added, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; changed, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; destroyed.
&lt;/pre&gt;


&lt;p&gt;無事にリソースを再作成することなくapplyできました。念のため再度planします。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform plan
module.vpc.aws_vpc.this: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;-0c91c8c5673d89ee5&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
aws_security_group.default: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;sg&lt;/span&gt;-02a601a6be35932e4&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-0edf4b9618cf8f38f&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-01629b6f8717a5523&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
&lt;/pre&gt;


&lt;p&gt;コードとstateが同期されていることを確認できました。&lt;/p&gt;

&lt;h2&gt;module内リソースのリネーム&lt;/h2&gt;

&lt;p&gt;ここからが本題のmoduleのリファクタリングです。&lt;/p&gt;

&lt;p&gt;vpcのリソース名を変更するので、先に確認しておきます。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform state list | &lt;span class=&quot;synStatement&quot;&gt;grep&lt;/span&gt; aws_vpc
module.vpc.aws_vpc.this
&lt;/pre&gt;


&lt;p&gt;リソース名を変更し、movedを定義します。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ git diff
diff &lt;span class=&quot;synSpecial&quot;&gt;--git&lt;/span&gt; a/modules/vpc/main.tf b/modules/vpc/main.tf
index 15d46e6..b6848a6 &lt;span class=&quot;synConstant&quot;&gt;100755&lt;/span&gt;
--- a/modules/vpc/main.tf
+++ b/modules/vpc/main.tf
@@ &lt;span class=&quot;synConstant&quot;&gt;-1&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;15&lt;/span&gt; +&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;20&lt;/span&gt; @@
-resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_vpc&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
+resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_vpc&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
   cidr_block  &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; var.vpc_cidr
   tags        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; Name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; var.vpc_name &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

+moved &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
+  from &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.this
+  to &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.default
+&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

 resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pub&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
   for_each &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;synStatement&quot;&gt;in&lt;/span&gt; var.subnet : i.name &lt;span class=&quot;synStatement&quot;&gt;=&amp;gt;&lt;/span&gt; i &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
-  vpc_id      &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.this.id
+  vpc_id      &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.default.id
   cidr_block  &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; each.value.cidr
   tags        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; Name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; each.value.name &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

 output &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc_id&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
-  value &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.this.id
+  value &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.default.id
 &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;planを実行します。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform plan
module.vpc.aws_vpc.default: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;-0c91c8c5673d89ee5&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
aws_security_group.default: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;sg&lt;/span&gt;-02a601a6be35932e4&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-01629b6f8717a5523&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-0edf4b9618cf8f38f&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;

Terraform will perform the following actions:

  &lt;span class=&quot;synComment&quot;&gt;# module.vpc.aws_vpc.this has moved to module.vpc.aws_vpc.default&lt;/span&gt;
    resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_vpc&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
        id                               &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc-0c91c8c5673d89ee5&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        tags                             &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc-sample&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;synComment&quot;&gt;# (15 unchanged attributes hidden)&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

Plan: &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to add, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to change, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to destroy.
&lt;/pre&gt;


&lt;p&gt;期待通りに、リネームするplanが出力されました。applyします（ログは省略）。&lt;/p&gt;

&lt;h2&gt;foreachを使ったリソースのリネーム&lt;/h2&gt;

&lt;p&gt;最後にforeachを使って生成したリソースをリネームできるか検証します。&lt;/p&gt;

&lt;p&gt;サブネットのリソース名を確認しておきます。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform state list | &lt;span class=&quot;synStatement&quot;&gt;grep&lt;/span&gt; aws_subnet
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;サブネットのリソース名を変更し、movedを定義しました。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ git diff
diff &lt;span class=&quot;synSpecial&quot;&gt;--git&lt;/span&gt; a/modules/vpc/main.tf b/modules/vpc/main.tf
index b6848a6..9fd0774 &lt;span class=&quot;synConstant&quot;&gt;100755&lt;/span&gt;
--- a/modules/vpc/main.tf
+++ b/modules/vpc/main.tf
@@ &lt;span class=&quot;synConstant&quot;&gt;-15&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;6&lt;/span&gt; +&lt;span class=&quot;synConstant&quot;&gt;15&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;15&lt;/span&gt; @@ resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pub&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
   tags        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; Name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; each.value.name &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

+moved &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
+  from &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;
+  to &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;
+&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
+moved &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
+  from &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;
+  to &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;
+&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
+
 output &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc_id&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
   value &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.default.id
 &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
diff &lt;span class=&quot;synSpecial&quot;&gt;--git&lt;/span&gt; a/vpc_sample/main.tf b/vpc_sample/main.tf
index 2cb6d0b..009f1d2 &lt;span class=&quot;synConstant&quot;&gt;100755&lt;/span&gt;
--- a/vpc_sample/main.tf
+++ b/vpc_sample/main.tf
@@ &lt;span class=&quot;synConstant&quot;&gt;-5&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;11&lt;/span&gt; +&lt;span class=&quot;synConstant&quot;&gt;5&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;11&lt;/span&gt; @@ module &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
   vpc_cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;172.16.0.0/16&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
   subnet &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;
     &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
-      name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
+      name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
       cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;172.16.0.0/20&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
     &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;,
     &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
-      name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
+      name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
       cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;172.16.16.0/20&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
     &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
   &lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;planを実行します。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform plan
module.vpc.aws_vpc.default: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;-0c91c8c5673d89ee5&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-01629b6f8717a5523&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
aws_security_group.default: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;sg&lt;/span&gt;-02a601a6be35932e4&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Refreshing state... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-0edf4b9618cf8f38f&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  &lt;span class=&quot;synComment&quot;&gt;# module.vpc.aws_subnet.pub[&amp;quot;pri-subnet-sample1&amp;quot;] will be updated in-place&lt;/span&gt;
  &lt;span class=&quot;synComment&quot;&gt;# (moved from module.vpc.aws_subnet.pub[&amp;quot;subnet-sample1&amp;quot;])&lt;/span&gt;
  ~ resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pub&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
        id                              &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-01629b6f8717a5523&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
      ~ tags                            &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
          ~ &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
      ~ tags_all                        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
          ~ &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;synComment&quot;&gt;# (9 unchanged attributes hidden)&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;synComment&quot;&gt;# module.vpc.aws_subnet.pub[&amp;quot;pri-subnet-sample2&amp;quot;] will be updated in-place&lt;/span&gt;
  &lt;span class=&quot;synComment&quot;&gt;# (moved from module.vpc.aws_subnet.pub[&amp;quot;subnet-sample2&amp;quot;])&lt;/span&gt;
  ~ resource &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;aws_subnet&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pub&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
        id                              &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-0edf4b9618cf8f38f&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
      ~ tags                            &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
          ~ &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
      ~ tags_all                        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
          ~ &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;synComment&quot;&gt;# (9 unchanged attributes hidden)&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

Plan: &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to add, &lt;span class=&quot;synConstant&quot;&gt;2&lt;/span&gt; to change, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; to destroy.
&lt;/pre&gt;


&lt;p&gt;期待通りにリネームするplanが出力されました。&lt;code&gt;change&lt;/code&gt;が２件出力されているのは&lt;code&gt;tags&lt;/code&gt;を変更したためです。論点ではないので、このままapplyします。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform apply
...
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Modifying... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-01629b6f8717a5523&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Modifying... &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-0edf4b9618cf8f38f&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Modifications &lt;span class=&quot;synStatement&quot;&gt;complete&lt;/span&gt; after 0s &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-0edf4b9618cf8f38f&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;
module.vpc.aws_subnet.pub&lt;span class=&quot;synStatement&quot;&gt;[&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;]&lt;/span&gt;: Modifications &lt;span class=&quot;synStatement&quot;&gt;complete&lt;/span&gt; after 0s &lt;span class=&quot;synStatement&quot;&gt;[&lt;/span&gt;id&lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;subnet&lt;/span&gt;-01629b6f8717a5523&lt;span class=&quot;synStatement&quot;&gt;]&lt;/span&gt;

Apply &lt;span class=&quot;synStatement&quot;&gt;complete&lt;/span&gt;! Resources: &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; added, &lt;span class=&quot;synConstant&quot;&gt;2&lt;/span&gt; changed, &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; destroyed.
&lt;/pre&gt;


&lt;p&gt;無事applyできました。&lt;/p&gt;

&lt;h2&gt;変更後のコード&lt;/h2&gt;

&lt;p&gt;modules/vpc/variables.tfは変更なし。&lt;/p&gt;

&lt;h3&gt;modules/vpc/main.tf&lt;/h3&gt;

&lt;pre class=&quot;code lang-tf&quot; data-lang=&quot;tf&quot; data-unlink&gt;resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_vpc&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;default&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  cidr_block  &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; var.vpc_cidr
  tags        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; Name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; var.vpc_name &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

moved &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  from &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.this
  to &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.default
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_subnet&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;pub&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  for_each &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;for&lt;/span&gt; i in var.subnet &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt; i.name &lt;span class=&quot;synStatement&quot;&gt;=&amp;gt;&lt;/span&gt; i &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
  vpc_id      &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.default.id
  cidr_block  &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; each.value.cidr
  tags        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt; Name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; each.value.name &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

moved &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  from &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_subnet.pub&lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;&amp;quot;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample1&lt;/span&gt;&amp;quot;&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
  to &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_subnet.pub&lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;&amp;quot;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&amp;quot;&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
moved &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  from &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_subnet.pub&lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;&amp;quot;&lt;span class=&quot;synConstant&quot;&gt;subnet-sample2&lt;/span&gt;&amp;quot;&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
  to &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_subnet.pub&lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;&amp;quot;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&amp;quot;&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

output &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;vpc_id&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  value &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_vpc.default.id
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;h3&gt;main.tf&lt;/h3&gt;

&lt;pre class=&quot;code lang-tf&quot; data-lang=&quot;tf&quot; data-unlink&gt;module &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;vpc&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  source &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;../modules/vpc&lt;/span&gt;&amp;quot;

  vpc_name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;vpc-sample&lt;/span&gt;&amp;quot;
  vpc_cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;172.16.0.0/16&lt;/span&gt;&amp;quot;
  subnet &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
      name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample1&lt;/span&gt;&amp;quot;
      cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;172.16.0.0/20&lt;/span&gt;&amp;quot;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;,
    &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
      name &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;pri-subnet-sample2&lt;/span&gt;&amp;quot;
      cidr &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;172.16.16.0/20&lt;/span&gt;&amp;quot;
    &lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;synStatement&quot;&gt;/&lt;/span&gt;/ moduleを使わない
resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;default&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  name        &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;securitygroup-sample1&lt;/span&gt;&amp;quot;
  vpc_id      &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; module.vpc.vpc_id
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

moved &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  from &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_security_group.this
  to &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; aws_security_group.default
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;h2&gt;所感&lt;/h2&gt;

&lt;p&gt;moduleをリファクタリングするにはstateの移動がかなり面倒で、リファクタリングを後回しにする要因になっていました。movedブロックはリファクタリングのトイルを減らす待望の機能追加です。&lt;/p&gt;
</content>        
        <category term="Terraform" label="Terraform" />
        
        <link rel="enclosure" href="https://cdn.image.st-hatena.com/image/scale/02b150b2d224b93d4181665e02961a9ae0612dcf/backend=imagemagick;version=1;width=1300/https%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2FJ%2FJHashimoto%2F20220508%2F20220508192237.png" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>LINQPadでユニットテストを書くには？</title>
        <link href="https://blog.jhashimoto.net/entry/2021/12/26/141024"/>
        <id>hatenablog://entry/13574176438046305612</id>
        <published>2021-12-26T14:10:24+09:00</published>
        <updated>2021-12-26T05:10:24+09:00</updated>        <summary type="html">サマリー LINQPadはv.6.9からxUnitをサポートしていて、ユニットテストが書けます。 https://www.linqpad.net/LINQPad6.aspx You can now add xunit test support to your query via new option on the Query menu. This adds the required references, a runner, and a sample test method to get you started. There&#39;s also a option on the Query menu …</summary>
        <content type="html">&lt;h2&gt;サマリー&lt;/h2&gt;

&lt;p&gt;LINQPadはv.6.9からxUnitをサポートしていて、ユニットテストが書けます。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.linqpad.net/LINQPad6.aspx&quot;&gt;https://www.linqpad.net/LINQPad6.aspx&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;You can now &lt;strong&gt;add xunit test support&lt;/strong&gt; to your query via new option on the &lt;strong&gt;Query&lt;/strong&gt; menu. This adds the required references, a runner, and a sample test method to get you started. There&#39;s also a option on the Query menu Alt+Shift+T to execute all tests.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;この記事では、LINQPadでのユニットテストの書き方を説明します。&lt;/p&gt;

&lt;h2&gt;実行環境&lt;/h2&gt;

&lt;p&gt;LINQPad 7 (Premium Edition) v7.1.5 (X64) on Windows 10&lt;/p&gt;

&lt;h2&gt;セットアップ&lt;/h2&gt;

&lt;p&gt;新規でQueryを作成します。&lt;code&gt;Language&lt;/code&gt;は&lt;code&gt;C# Program&lt;/code&gt;を選びました。&lt;/p&gt;

&lt;pre class=&quot;code lang-cs&quot; data-lang=&quot;cs&quot; data-unlink&gt;&lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Main() {
    
}

&lt;span class=&quot;synComment&quot;&gt;// You can define other methods, fields, classes and namespaces here&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;Query&lt;/code&gt;メニューから&lt;code&gt;Add XUnit Test Support&lt;/code&gt;を選ぶと、テンプレートが挿入されます。&lt;/p&gt;

&lt;pre class=&quot;code lang-cs&quot; data-lang=&quot;cs&quot; data-unlink&gt;#load &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;xunit&amp;quot;&lt;/span&gt;

&lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Main() {
    &lt;span class=&quot;synComment&quot;&gt;//RunTests();  // Call RunTests() or press Alt+Shift+T to initiate testing.&lt;/span&gt;
}

&lt;span class=&quot;synComment&quot;&gt;// You can define other methods, fields, classes and namespaces here&lt;/span&gt;

&lt;span class=&quot;synPreProc&quot;&gt;#region private::Tests&lt;/span&gt;

[Fact] &lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Test_Xunit() =&amp;gt; Assert.True (&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; + &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; == &lt;span class=&quot;synConstant&quot;&gt;2&lt;/span&gt;);

&lt;span class=&quot;synPreProc&quot;&gt;#endregion&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;初回はConfirmationダイアログが表示されるので、&lt;code&gt;はい&lt;/code&gt;を選んで、xUnitのPackageをダウンロードします。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20211226/20211226135655.png&quot; alt=&quot;f:id:JHashimoto:20211226135655p:plain&quot; width=&quot;338&quot; height=&quot;198&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Alt + Shift + T&lt;/code&gt;でテストを実行できます。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20211226/20211226135719.png&quot; alt=&quot;f:id:JHashimoto:20211226135719p:plain&quot; width=&quot;528&quot; height=&quot;135&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;コードを修正して、NGをテストします。&lt;/p&gt;

&lt;pre class=&quot;code lang-cs&quot; data-lang=&quot;cs&quot; data-unlink&gt;&lt;span class=&quot;synPreProc&quot;&gt;#region private::Tests&lt;/span&gt;

[Fact] &lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Test_Xunit() =&amp;gt; Assert.True (&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; + &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; == &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;);

&lt;span class=&quot;synPreProc&quot;&gt;#endregion&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;期待通りNGになりました。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20211226/20211226135742.png&quot; alt=&quot;f:id:JHashimoto:20211226135742p:plain&quot; width=&quot;707&quot; height=&quot;201&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;コードをテストしてみる&lt;/h2&gt;

&lt;p&gt;文字列を返す簡単なメソッドとテストコードを書きます。&lt;/p&gt;

&lt;pre class=&quot;code lang-cs&quot; data-lang=&quot;cs&quot; data-unlink&gt;&lt;span class=&quot;synType&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;string&lt;/span&gt; GetGreeting(&lt;span class=&quot;synType&quot;&gt;string&lt;/span&gt; name) {
    &lt;span class=&quot;synStatement&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Hello {name}&amp;quot;&lt;/span&gt;;
}

&lt;span class=&quot;synPreProc&quot;&gt;#region private::Tests&lt;/span&gt;

[Fact] &lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Test_Xunit() =&amp;gt; Assert.True (&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; + &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; == &lt;span class=&quot;synConstant&quot;&gt;2&lt;/span&gt;);

[Fact] &lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Test_GetGreeting_OK() =&amp;gt; Assert.Equal(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Hello Bob&amp;quot;&lt;/span&gt;, GetGreeting(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Bob&amp;quot;&lt;/span&gt;));
[Fact] &lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Test_GetGreeting_NG() =&amp;gt; Assert.NotEqual(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Hello Bob&amp;quot;&lt;/span&gt;, GetGreeting(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Alice&amp;quot;&lt;/span&gt;));

&lt;span class=&quot;synPreProc&quot;&gt;#endregion&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;期待通りのテスト結果になりました。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20211226/20211226135832.png&quot; alt=&quot;f:id:JHashimoto:20211226135832p:plain&quot; width=&quot;547&quot; height=&quot;193&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;テストコードを別ファイルにする&lt;/h2&gt;

&lt;p&gt;コード量が多くなると、テストコードを別ファイルにした方が見通しがよくなります。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/52798462/is-it-possible-to-use-xunit-with-linqpad&quot;&gt;Is it possible to use xUnit with LINQPad? - Stack Overflow&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;This will add a query with required boilerplate code &lt;a href=&quot;https://www.linqpad.net/LinqReference.aspx&quot;&gt;referenced via #load&lt;/a&gt; so you can start testing facts and theories instantly.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;#load&lt;/code&gt;ディレクティブでできるようなので、試してみます。&lt;/p&gt;

&lt;p&gt;GetGreetingメソッドを&lt;code&gt;GetGreeting.linq&lt;/code&gt;に移動しました。&lt;/p&gt;

&lt;pre class=&quot;code lang-cs&quot; data-lang=&quot;cs&quot; data-unlink&gt;&lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Main() {
    &lt;span class=&quot;synComment&quot;&gt;//RunTests();  // Call RunTests() or press Alt+Shift+T to initiate testing.&lt;/span&gt;
    GetGreeting(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Bob&amp;quot;&lt;/span&gt;).Dump();
}

&lt;span class=&quot;synComment&quot;&gt;// You can define other methods, fields, classes and namespaces here&lt;/span&gt;

&lt;span class=&quot;synType&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;string&lt;/span&gt; GetGreeting(&lt;span class=&quot;synType&quot;&gt;string&lt;/span&gt; name) {
    &lt;span class=&quot;synStatement&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Hello {name}&amp;quot;&lt;/span&gt;;
}
&lt;/pre&gt;


&lt;p&gt;テストコードに&lt;code&gt;#load &quot;GetGreeting&quot;&lt;/code&gt;を入れます。&lt;/p&gt;

&lt;pre class=&quot;code lang-cs&quot; data-lang=&quot;cs&quot; data-unlink&gt;#load &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;xunit&amp;quot;&lt;/span&gt;
#load &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;GetGreeting&amp;quot;&lt;/span&gt;

&lt;span class=&quot;synPreProc&quot;&gt;#region private::Tests&lt;/span&gt;

[Fact] &lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Test_Xunit() =&amp;gt; Assert.True (&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; + &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; == &lt;span class=&quot;synConstant&quot;&gt;2&lt;/span&gt;);

[Fact] &lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Test_GetGreeting_OK() =&amp;gt; Assert.Equal(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Hello Bob&amp;quot;&lt;/span&gt;, GetGreeting(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Bob&amp;quot;&lt;/span&gt;));
[Fact] &lt;span class=&quot;synType&quot;&gt;void&lt;/span&gt; Test_GetGreeting_NG() =&amp;gt; Assert.NotEqual(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Hello Bob&amp;quot;&lt;/span&gt;, GetGreeting(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;Alice&amp;quot;&lt;/span&gt;));

&lt;span class=&quot;synPreProc&quot;&gt;#endregion&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;別ファイルのメソッドをテストできました。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20211226/20211226135905.png&quot; alt=&quot;f:id:JHashimoto:20211226135905p:plain&quot; width=&quot;547&quot; height=&quot;193&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;まとめ&lt;/h2&gt;

&lt;p&gt;LINQPadはVisual Studioに比べてコードを書くまでのオーバーヘッドが小さく、検証・テスト用途で便利に使っていました。一方でテストが書けないためコード量が多くなるにつれ、開発効率が落ちる傾向がありました。&lt;/p&gt;

&lt;p&gt;ユニットテストを用意することで、今後は複雑なコードもLINQPadで書けそうな感触を得ました。&lt;/p&gt;

&lt;h2&gt;参考&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.linqpad.net/LinqReference.aspx&quot;&gt;https://www.linqpad.net/LinqReference.aspx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fforum.linqpad.net%2Fdiscussion%2F2144%2Flinqpad-6-and-xunit-test-framework&quot; title=&quot;LinqPad 6 and xUnit test framework&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://forum.linqpad.net/discussion/2144/linqpad-6-and-xunit-test-framework&quot;&gt;forum.linqpad.net&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="C#" label="C#" />
        
        <category term="LINQPad" label="LINQPad" />
        
        <category term="xUnit" label="xUnit" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/13574176438046305612/1641161398" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Terraform作業ディレクトリの容量を節約するには？</title>
        <link href="https://blog.jhashimoto.net/entry/2021/12/24/090000"/>
        <id>hatenablog://entry/13574176438045601804</id>
        <published>2021-12-24T09:00:00+09:00</published>
        <updated>2021-12-24T00:00:08+09:00</updated>        <summary type="html">問題 ディスク領域不足のアラートが出た。 terraformerのimportを何度も繰り返したせいで、作業ディレクトリ全部にTerrafromのプロバイダープラグインがダウンロードされていたのが原因。 サマリ― Terraform作業ディレクトリの容量を節約するには、プラグインをキャッシュするとよい。</summary>
        <content type="html">&lt;h2&gt;問題&lt;/h2&gt;

&lt;p&gt;ディスク領域不足のアラートが出た。&lt;/p&gt;

&lt;p&gt;terraformerのimportを何度も繰り返したせいで、作業ディレクトリ全部にTerrafromのプロバイダープラグインがダウンロードされていたのが原因。&lt;/p&gt;

&lt;h2&gt;サマリ―&lt;/h2&gt;

&lt;p&gt;Terraform作業ディレクトリの容量を節約するには、プラグインをキャッシュするとよい。&lt;/p&gt;

&lt;h2&gt;作業ログ&lt;/h2&gt;

&lt;p&gt;作業ログを残しておきます。&lt;/p&gt;

&lt;p&gt;ホームディレクトリに&lt;code&gt;.terraformrc&lt;/code&gt;を作成し、キャッシュディレクトリを設定する。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ &lt;span class=&quot;synStatement&quot;&gt;cd&lt;/span&gt;    &lt;span class=&quot;synComment&quot;&gt;# ホームディレクトリに移動&lt;/span&gt;
$ cat &lt;span class=&quot;synStatement&quot;&gt;&amp;lt;&amp;lt; EOF&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; &amp;gt; .terraformrc&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;plugin_cache_dir   = &amp;quot;&lt;/span&gt;&lt;span class=&quot;synPreProc&quot;&gt;$HOME&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;/.terraform.d/plugin-cache&amp;quot;&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;EOF&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;作業ディレクトリの使用容量を確認しておく。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ &lt;span class=&quot;synStatement&quot;&gt;du&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;-hs&lt;/span&gt;
235M    .
&lt;/pre&gt;


&lt;p&gt;プラグインを削除。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ &lt;span class=&quot;synStatement&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;-rf&lt;/span&gt; .terraform/
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;terraform init&lt;/code&gt;でエラーが発生。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform init
There are some problems with the CLI configuration:
╷
│ Error: The specified plugin cache dir /home/jhashimoto/.terraform.d/plugin-cache cannot be opened: stat /home/jhashimoto/.terraform.d/plugin-cache: no such file or directory
│
╵
&lt;/pre&gt;


&lt;p&gt;公式ドキュメントに情報があった。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.terraform.io/docs/cli/config/config-file.html&quot;&gt;CLI Configuration - Terraform by HashiCorp&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;This directory must already exist before Terraform will cache plugins; Terraform will not create the directory itself.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;キャッシュディレクトリはTeraformが作成してくれると思ってたが、事前に作らないといけなかった。&lt;/p&gt;

&lt;p&gt;ディレクトリを作成してリトライしたら、成功した。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ &lt;span class=&quot;synStatement&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synPreProc&quot;&gt;$HOME&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;/.terraform.d/plugin-cache&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;
$ terraform init

Initializing the backend...

Initializing provider plugins...
- terraform.io/&lt;span class=&quot;synStatement&quot;&gt;builtin&lt;/span&gt;/terraform is built &lt;span class=&quot;synError&quot;&gt;in&lt;/span&gt; to Terraform
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using hashicorp/aws v3.&lt;span class=&quot;synConstant&quot;&gt;68&lt;/span&gt;.&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; from the shared cache directory

...

Terraform has been successfully initialized!
...
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;Using hashicorp/aws v3.68.0 from the shared cache directory&lt;/code&gt;からキャッシュを利用しているのがわかる。&lt;/p&gt;

&lt;p&gt;プラグインをキャッシュした分使用量が減っている。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ &lt;span class=&quot;synStatement&quot;&gt;du&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;-hs&lt;/span&gt;
465K    .
&lt;/pre&gt;


&lt;p&gt;念のためplanできるか確認。&lt;/p&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform plan

...

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Note: You didn&lt;span class=&quot;synStatement&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;t use the -out option to save this plan, so Terraform can&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&#39;&lt;/span&gt;t guarantee to take exactly these actions &lt;span class=&quot;synStatement&quot;&gt;if &lt;/span&gt;you run &lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;terraform apply&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;quot;&lt;/span&gt; now.
&lt;/pre&gt;


&lt;h2&gt;実行環境&lt;/h2&gt;

&lt;pre class=&quot;code lang-sh&quot; data-lang=&quot;sh&quot; data-unlink&gt;$ terraform &lt;span class=&quot;synSpecial&quot;&gt;--version&lt;/span&gt;
Terraform v1.&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;synConstant&quot;&gt;9&lt;/span&gt;
on linux_amd64
&lt;/pre&gt;


&lt;p&gt;ubuntu-20.04 on Windows 10 (WSL2)&lt;/p&gt;

&lt;h2&gt;参考&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://qiita.com/tonishy/items/adcf67e959dffaa03f93&quot;&gt;知らず知らずのうちに Terraform がディスクをほとんど一杯にしてた - Qiita&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.terraform.io/docs/cli/config/config-file.html&quot;&gt;CLI Configuration - Terraform by HashiCorp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>        
        <category term="Terraform" label="Terraform" />
        
        <category term="トラブルシュート" label="トラブルシュート" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/13574176438045601804/1640304008" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>【Terraform】moduleへの依存を明示する</title>
        <link href="https://blog.jhashimoto.net/entry/2021/08/15/173325"/>
        <id>hatenablog://entry/26006613797623387</id>
        <published>2021-08-15T17:33:25+09:00</published>
        <updated>2021-08-15T08:33:25+09:00</updated>        <summary type="html">Terraformはリソースの依存関係を自動的に解決してくれますが、明示的な指定が必要なケースがあります。</summary>
        <content type="html">&lt;p&gt;Terraformはリソースの依存関係を自動的に解決してくれますが、明示的な指定が必要なケースがあります。&lt;/p&gt;

&lt;h2&gt;シナリオ&lt;/h2&gt;

&lt;p&gt;次のシナリオを考えます。&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;リソース

&lt;ol&gt;
&lt;li&gt;S3バケット (バケット)&lt;/li&gt;
&lt;li&gt;セキュリティグループ&lt;/li&gt;
&lt;li&gt;EC2インスタンス (インスタンス)&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;依存関係

&lt;ol&gt;
&lt;li&gt;インスタンスにセキュリティグループをアタッチする&lt;/li&gt;
&lt;li&gt;インスタンスはバケットに依存する（起動時にバケットからアプリケーションをダウンロードする）&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;リソースへの依存を明示する&lt;/h2&gt;

&lt;p&gt;インスタンスのセキュリティグループへの依存はTerraformが解決してくれますが、バケットへの依存はTerraformは検知できません（知りようがありません）。&lt;/p&gt;

&lt;p&gt;このようなケースでは&lt;code&gt;aws_instance.ec2&lt;/code&gt;の&lt;code&gt;depends_on&lt;/code&gt;でバケットへの依存を指定します。&lt;/p&gt;

&lt;pre class=&quot;code lang-tf&quot; data-lang=&quot;tf&quot; data-unlink&gt;resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_s3_bucket&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;this&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
...
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_security_group&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;this&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
...
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_instance&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;ec2&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
...
    depends_on &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;aws_s3_bucket.this&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;h2&gt;リソースをmodule化する&lt;/h2&gt;

&lt;p&gt;では、インスタンスに必要なリソースをmodule化したい場合は、どうすればいいのでしょうか。&lt;/p&gt;

&lt;p&gt;こんなケースです。&lt;/p&gt;

&lt;pre class=&quot;code lang-tf&quot; data-lang=&quot;tf&quot; data-unlink&gt;module &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;bucket&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  source &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;../modules/storage/s3/private_bucket&lt;/span&gt;&amp;quot;
....
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

module &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;sg&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
  source &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;../modules/network/security_group&lt;/span&gt;&amp;quot;
....
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;

resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_instance&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;ec2&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
...
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;h2&gt;検証&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;depends_on = [module.bucket]&lt;/code&gt;でmoduleへの依存を明示できそうな気がします。検証してみました。&lt;/p&gt;

&lt;h3&gt;depends_onなし&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;terraform graph | dot -Tpng &amp;gt; graph.png&lt;/code&gt;で依存関係を可視化すると、aws_instance_ec2はmodule.bucketに依存していないことがわかります。&lt;/p&gt;

&lt;p&gt;サイズが大きいので、関係する箇所だけ貼ります。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20210815/20210815172754.png&quot; alt=&quot;f:id:JHashimoto:20210815172754p:plain&quot; width=&quot;1165&quot; height=&quot;200&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;depends_onあり&lt;/h3&gt;

&lt;p&gt;既出のコードにdepends_onを追加します。&lt;/p&gt;

&lt;pre class=&quot;code lang-tf&quot; data-lang=&quot;tf&quot; data-unlink&gt;resource &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;aws_instance&lt;/span&gt;&amp;quot; &amp;quot;&lt;span class=&quot;synConstant&quot;&gt;ec2&lt;/span&gt;&amp;quot; &lt;span class=&quot;synSpecial&quot;&gt;{&lt;/span&gt;
...
  depends_on &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;[&lt;/span&gt;module.bucket&lt;span class=&quot;synSpecial&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;synSpecial&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;applyして依存関係を出力すると、aws_instance_ec2にmodule.bucketへの依存が設定されています。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20210815/20210815172131.png&quot; alt=&quot;f:id:JHashimoto:20210815172131p:plain&quot; width=&quot;1200&quot; height=&quot;162&quot; loading=&quot;lazy&quot; title=&quot;&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;後で確認したら、リファレンスにちゃんと書いてありました。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.terraform.io%2Fdocs%2Flanguage%2Fmeta-arguments%2Fdepends_on.html&quot; title=&quot;The depends_on Meta-Argument - Configuration Language - Terraform by HashiCorp&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://www.terraform.io/docs/language/meta-arguments/depends_on.html&quot;&gt;www.terraform.io&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Version note: Module support for depends_on was added in Terraform 0.13, and previous versions can only use it with resources.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;depends_onのmoduleサポートはver.0.13のアップデートで入っていました。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmedium.com%2Fhashicorp-engineering%2Fcreating-module-dependencies-in-terraform-0-13-4322702dac4a&quot; title=&quot;Creating Module Dependencies in Terraform 0.13&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://medium.com/hashicorp-engineering/creating-module-dependencies-in-terraform-0-13-4322702dac4a&quot;&gt;medium.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="Terraform" label="Terraform" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/26006613797623387/1629016708" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>【Thunderbird】メールリストのフォントサイズを変更するには？</title>
        <link href="https://blog.jhashimoto.net/entry/2020/03/15/085755"/>
        <id>hatenablog://entry/26006613535464114</id>
        <published>2020-03-15T08:57:55+09:00</published>
        <updated>2020-03-14T23:57:55+09:00</updated>        <summary type="html">Summary 拡張機能は公開が停止されているようなので、CSSをカスタマイズします。</summary>
        <content type="html">&lt;h3&gt;Summary&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://addons.thunderbird.net/en-us/thunderbird/addon/theme-font-size-changer/&quot;&gt;拡張機能&lt;/a&gt;は公開が停止されているようなので、CSSをカスタマイズします。&lt;/p&gt;

&lt;h3&gt;環境&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Windows 10&lt;/li&gt;
&lt;li&gt;Thunderbird 68.6.0 (64bit)&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;手順&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Profileの確認

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;C:\users\[User Name]\AppData\Roaming\Thunderbird\Profiles\&lt;/code&gt;にProfileがある。

&lt;ul&gt;
&lt;li&gt;複数のProfileフォルダがある場合、&lt;code&gt;Thunderbird -profilemanager&lt;/code&gt;を実行しProfile Managerを起動して、適用されているProfileを確認。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;cssファイル作成

&lt;ul&gt;
&lt;li&gt;Profileフォルダに&lt;code&gt;chrome/userChrome.css&lt;/code&gt;を作成する。&lt;code&gt;font-size&lt;/code&gt;はお好みで。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Thunderbird起動&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;userChrome.css&lt;/h3&gt;

&lt;pre class=&quot;code lang-css&quot; data-lang=&quot;css&quot; data-unlink&gt;&lt;span class=&quot;synComment&quot;&gt;/*&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt; * Do not remove the @namespace line -- it&#39;s required for correct functioning&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt; */&lt;/span&gt;
&lt;span class=&quot;synPreProc&quot;&gt;@namespace&lt;/span&gt; url(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul&amp;quot;&lt;/span&gt;); &lt;span class=&quot;synComment&quot;&gt;/* set default namespace to XUL */&lt;/span&gt;

&lt;span class=&quot;synComment&quot;&gt;/* &lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt; * Make all the default font sizes 9 pt:&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt; */&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;font-size&lt;/span&gt;: &lt;span class=&quot;synConstant&quot;&gt;9pt&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;!important&lt;/span&gt;; &lt;span class=&quot;synIdentifier&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;


&lt;h3&gt;Reference&lt;/h3&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsupport.mozilla.org%2Fen-US%2Fquestions%2F1198055&quot; title=&quot;Is there a way to increase the font size in the message list pane and folder list with MacOS? | Thunderbird Support Forum | Mozilla Support&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://support.mozilla.org/en-US/questions/1198055&quot;&gt;support.mozilla.org&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FMozilla%2FThunderbird%2FThunderbird_Configuration_Files&quot; title=&quot;Thunderbird Configuration Files&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Thunderbird_Configuration_Files&quot;&gt;developer.mozilla.org&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://kb.mozillazine.org/Moving_your_profile_folder_-_Thunderbird&quot;&gt;Moving your profile folder - Thunderbird - MozillaZine Knowledge Base&lt;/a&gt;&lt;/p&gt;
</content>        
        <category term="ツール" label="ツール" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/26006613535464114/1587870089" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Windows 10にMinikubeをインストールするには？</title>
        <link href="https://blog.jhashimoto.net/entry/2020/01/10/123000"/>
        <id>hatenablog://entry/26006613495588406</id>
        <published>2020-01-10T12:30:00+09:00</published>
        <updated>2020-01-10T03:30:01+09:00</updated>        <summary type="html">Summary Minikubeはローカルで稼働するKubernetesクラスタです。WindowsのHyper-V上にMinikubeをインストールしてみました。</summary>
        <content type="html">&lt;h3&gt;Summary&lt;/h3&gt;

&lt;p&gt;Minikubeはローカルで稼働するKubernetesクラスタです。WindowsのHyper-V上にMinikubeをインストールしてみました。&lt;/p&gt;

&lt;h3&gt;Windows 10にMinikubeをインストールするには？&lt;/h3&gt;

&lt;p&gt;今回はChocolateyを使います。管理者権限で起動したPowershellで以下のコマンドを実行します。&lt;/p&gt;

&lt;pre class=&quot;code lang-ps1&quot; data-lang=&quot;ps1&quot; data-unlink&gt;PS &amp;gt; choco install minikube
...
PS &amp;gt; minikube start --&lt;span class=&quot;synStatement&quot;&gt;vm-driver&lt;/span&gt;=hyperv
...
PS &amp;gt; minikube config set &lt;span class=&quot;synStatement&quot;&gt;vm-driver&lt;/span&gt; hyperv    &lt;span class=&quot;synComment&quot;&gt;# To make hyperv the default driver:&lt;/span&gt;
! These changes will take effect upon a minikube delete and then a minikube start
PS &amp;gt; kubectl get pod -A    &lt;span class=&quot;synComment&quot;&gt;# for Command Testing&lt;/span&gt;
NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;coredns-6955765f44&lt;/span&gt;-lldqb           &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;coredns-6955765f44&lt;/span&gt;-tbtns           &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;etcd-minikube&lt;/span&gt;                      &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;kube-addon&lt;/span&gt;-&lt;span class=&quot;synStatement&quot;&gt;manager-minikube&lt;/span&gt;        &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;kube-apiserver&lt;/span&gt;-minikube            &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;kube-controller&lt;/span&gt;-&lt;span class=&quot;synStatement&quot;&gt;manager-minikube&lt;/span&gt;   &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;kube-proxy&lt;/span&gt;-j7nng                   &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;kube-scheduler&lt;/span&gt;-minikube            &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;span class=&quot;synStatement&quot;&gt;kube-system&lt;/span&gt;   &lt;span class=&quot;synStatement&quot;&gt;storage-provisioner&lt;/span&gt;                &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;/&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;     Running   &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;          30m
&lt;/pre&gt;


&lt;h3&gt;Reference&lt;/h3&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fminikube.sigs.k8s.io%2Fdocs%2Fstart%2Fwindows%2F&quot; title=&quot;Windows&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://minikube.sigs.k8s.io/docs/start/windows/&quot;&gt;minikube.sigs.k8s.io&lt;/a&gt;&lt;/cite&gt;
&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.jhashimoto.net%2Fentry%2F2016%2F11%2F02%2F132736&quot; title=&quot;【自動化】ChocolateyでWindowsアプリのインストールを自動化する - プログラマーな日々&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://blog.jhashimoto.net/entry/2016/11/02/132736&quot;&gt;blog.jhashimoto.net&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="Kubernetes" label="Kubernetes" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/26006613495588406/1578658265" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>【Docker】Docker Desktopの自動起動を無効にできない</title>
        <link href="https://blog.jhashimoto.net/entry/2019/10/30/093800"/>
        <id>hatenablog://entry/26006613457869082</id>
        <published>2019-10-30T09:38:00+09:00</published>
        <updated>2019-10-30T00:38:00+09:00</updated>        <summary type="html">Start Docker Desktop when you log inを設定しても、Docker Desktopが自動起動する。 環境 Windows 10 バージョン1903 Docker Desktop 2.1.0.4(39773)</summary>
        <content type="html">&lt;p&gt;&lt;code&gt;Start Docker Desktop when you log in&lt;/code&gt;を設定しても、Docker Desktopが自動起動する。&lt;/p&gt;

&lt;h2&gt;環境&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Windows 10 バージョン1903&lt;/li&gt;
&lt;li&gt;Docker Desktop 2.1.0.4(39773)&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;対応&lt;/h2&gt;

&lt;p&gt;レジストリを直接編集する。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run&lt;/code&gt;から&lt;code&gt;Docker Desktop&lt;/code&gt;のエントリを削除する。&lt;/p&gt;

&lt;h2&gt;参考&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://forums.docker.com/t/docker-desktop-always-starts-although-disabled/63494/17&quot;&gt;Docker Desktop always starts although disabled - Docker Desktop for Windows - Docker Forums&lt;/a&gt;&lt;/p&gt;
</content>        
        <category term="Docker" label="Docker" />
        
        <category term="トラブルシュート" label="トラブルシュート" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/26006613457869082/1572395880" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>AWS障害の振り返り</title>
        <link href="https://blog.jhashimoto.net/entry/2019/08/26/212311"/>
        <id>hatenablog://entry/26006613406169275</id>
        <published>2019-08-26T21:23:11+09:00</published>
        <updated>2019-08-26T12:23:11+09:00</updated>        <summary type="html">社内で共有した文書です。クラウド初心者向けに書いているので、割り引いて読んでください。</summary>
        <content type="html">&lt;p&gt;社内で共有した文書です。クラウド初心者向けに書いているので、割り引いて読んでください。&lt;/p&gt;

&lt;p&gt;2019/08/23の障害についてAWSがサマリーを公表しました。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Faws.amazon.com%2Fjp%2Fmessage%2F56489%2F&quot; title=&quot;Summary of the Amazon EC2 Issues in the Asia Pacific (Tokyo) Region (AP-NORTHEAST-1)&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://aws.amazon.com/jp/message/56489/&quot;&gt;aws.amazon.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;AZ（データセンターのこと）の空調設備の障害によるオーバーヒートが原因とのことでした。&lt;/p&gt;

&lt;p&gt;一部のインスタンスについては、ハードウェアの障害によりリタイヤが必要だったと書かれています。&lt;/p&gt;

&lt;p&gt;顧客のインスタンスが一部復旧せず、休日のサーバー再構築が必要だったと聞きました。&lt;/p&gt;

&lt;p&gt;EC2は仮想サーバーなので、基盤の物理サーバーが壊れたらインスタンスも壊れます。それに対処するのは、AWSユーザーの責任です。このあたりは、責任共有モデルとして説明されています。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Faws.amazon.com%2Fjp%2Fcompliance%2Fshared-responsibility-model%2F&quot; title=&quot;責任共有モデル | AWS&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://aws.amazon.com/jp/compliance/shared-responsibility-model/&quot;&gt;aws.amazon.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;この記事がわかりやすいです。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftech.nikkeibp.co.jp%2Fit%2Fatcl%2Fcolumn%2F17%2F010400601%2F010400008%2F&quot; title=&quot;AWSのセキュリティや注意点、「責任共有モデル」を知り使いこなす&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://tech.nikkeibp.co.jp/it/atcl/column/17/010400601/010400008/&quot;&gt;tech.nikkeibp.co.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;AWSの設計指針として「クラウドコンピューティングのアーキテクチャ: ベストプラクティス」というホワイトペーパーがある。&lt;/p&gt;

&lt;p&gt;そこにいくつか記されている指針の中で、最も有名なのがDesign for failureだ。「システムは故障する可能性があるものだという前提を受け入れ、あらかじめ故障に備えた設計をする」という考え方である。&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;では、具体的にどう対処したらいいのか？という話ですが、障害によるシステムダウンを回避する設計をする必要があります。&lt;/p&gt;

&lt;p&gt;クラウドらしい（クラウドの価値を十分に享受できる）順に以下となります。&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;マネージドサービスを組み合わせる&lt;/li&gt;
&lt;li&gt;EC2のMultiAZ構成&lt;/li&gt;
&lt;li&gt;単一のEC2インスタンス&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;1.が最も望ましい選択肢です。非機能要件の実現をクラウドベンダーに任せることができ、運用フェーズが楽になります。&lt;/p&gt;

&lt;p&gt;公式の資料では、こちらがわかりやすいです。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://www.slideshare.net/slideshow/embed_code/key/2AcVbzd1IQOGI&quot; width=&quot;427&quot; height=&quot;356&quot; frameborder=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; scrolling=&quot;no&quot; style=&quot;border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;&quot; allowfullscreen&gt; &lt;/iframe&gt; &lt;div style=&quot;margin-bottom:5px&quot;&gt; &lt;strong&gt; &lt;a href=&quot;https://www.slideshare.net/AmazonWebServicesJapan/aws-black-belt-online-seminar-2016&quot; title=&quot;AWS Black Belt Online Seminar 2016 クラウドのためのアーキテクチャ設計 -ベストプラクティス-&quot; target=&quot;_blank&quot;&gt;AWS Black Belt Online Seminar 2016 クラウドのためのアーキテクチャ設計 -ベストプラクティス-&lt;/a&gt; &lt;/strong&gt; from &lt;strong&gt;&lt;a href=&quot;https://www.slideshare.net/AmazonWebServicesJapan&quot; target=&quot;_blank&quot;&gt;Amazon Web Services Japan&lt;/a&gt;&lt;/strong&gt; &lt;/div&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://www.slideshare.net/AmazonWebServicesJapan/aws-black-belt-online-seminar-2016/53&quot;&gt;www.slideshare.net&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;1.が困難な場合は2.を選択すると、可用性を高めることができます。&lt;/p&gt;

&lt;p&gt;ただし、&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;インフラとアプリケーションを冗長化できるよう設計する必要があります。シングルインスタンスで稼働しているシステムを単純にMultiAZに移行できるわけではありません。&lt;/li&gt;
&lt;li&gt;冗長化するので使用料金は上がる&lt;/li&gt;
&lt;li&gt;まじめに運用設計しないと、インスタンスが増える分だけ運用コストが上がる&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;3.は止むを得ないケース以外は避けてください。オンプレでサーバーを運用するのとほとんど変わりません。
他に選択肢がなく採用する場合は、インスタンスのバックアップ（AMI Or スナップショット）を定期的に取得するようにしてください。&lt;/p&gt;
</content>        
        <category term="AWS" label="AWS" />
        
        <category term="障害" label="障害" />
        
        <category term="設計" label="設計" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/26006613406169275/1566822191" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>【Microsoft To-Do】待望のアップデートでリストのグループ化が可能に！</title>
        <link href="https://blog.jhashimoto.net/entry/2019/08/14/000434"/>
        <id>hatenablog://entry/26006613394849583</id>
        <published>2019-08-14T00:04:34+09:00</published>
        <updated>2019-08-13T15:04:34+09:00</updated>        <summary type="html">Microsoft To-Doでリストのグループ化ができるようになりました。個人的には待望のアップデートです。 techcommunity.microsoft.com</summary>
        <content type="html">&lt;p&gt;Microsoft To-Doでリストのグループ化ができるようになりました。個人的には待望のアップデートです。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-To-Do-Blog%2FYour-most-requested-feature-is-here-list-groups%2Fba-p%2F800168&quot; title=&quot;Your most requested feature is here – list groups!&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://techcommunity.microsoft.com/t5/Microsoft-To-Do-Blog/Your-most-requested-feature-is-here-list-groups/ba-p/800168&quot;&gt;techcommunity.microsoft.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;Wonderlistから移行して唯一不便だったのは、フォルダがないことでした。これで解決です。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20190814/20190814000332.png&quot; alt=&quot;f:id:JHashimoto:20190814000332p:plain&quot; title=&quot;f:id:JHashimoto:20190814000332p:plain&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;この機能は、ユーザーフォーラムで議論されていたものです。開発が活発なので今後に期待です。&lt;/p&gt;

&lt;p&gt;&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt; div.uv-card {background: #fff;border: 1px solid #CED6E6;-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;color: #5C5F66;font: normal 11px/1.3em &quot;HelveticaNeue&quot;, Arial, sans-serif;margin: 0;max-width: 500px;padding: 10px 10px 5px 10px;text-rendering: optimizelegibility;zoom: 1;}div.uv-card:after {content: &quot;.&quot;;display: block;height: 0;clear: both;visibility: hidden;}.uv-card-info {line-height: 1em;margin-bottom: 10px;}.uv-card-topic {color: #A0A6B3;display: inline-block;}.uv-card-status {background: #DBF0B4;-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;color: #446600;display: inline-block;font-size: 10px;font-weight: bold;margin-right: 5px;padding: 3px 5px;text-transform: uppercase;}.uv-card-meta {float: right;list-style: none;line-height: 16px;margin: 0 0 10px 20px;padding: 0;}.uv-card-meta li {margin: 0 0 .7em 0;padding: 0;}.uv-card-meta img {border: none;vertical-align: bottom;}.uv-card-votes {background: #F9FAFC;border: 1px solid #DBDEE6;display: inline-block;-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;}.uv-card-votes-button {background: #F3F6FA;border: 1px solid #A0A6B3;-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;color: #293E66;display: inline-block;font-weight: bold;margin: -1px;padding: 3px 7px 3px 5px;text-decoration: none;}.uv-card-votes-count {display: inline-block;padding-right: 7px;margin-left: 3px;}.uv-card-comments,.uv-card-votecount {display: inline-block;padding: 3px 5px;}.uv-card-votecount {color: #576800;}.uv-card-title {color: #293E66;font-size: 15px;font-weight: bold;margin: 0 0 10px 0;padding: 0;}h2.uv-card-title a {color: inherit;text-decoration: none;}.uv-card-description {margin-bottom: 10px;}.uv-card-description p {margin: 0 0 .7em 0;padding: 0;}&lt;/style&gt; &lt;div class=&quot;uv-card&quot;&gt; &lt;div class=&quot;uv-card-info&quot;&gt; &lt;div class=&quot;uv-card-status uv-card-status-we-have-this&quot;&gt;we have this&lt;/div&gt; &lt;div class=&quot;uv-card-topic&quot;&gt;How can we improve Microsoft To-Do?&lt;/div&gt; &lt;/div&gt; &lt;ul class=&quot;uv-card-meta&quot;&gt;    &lt;li&gt; &lt;div class=&quot;uv-card-votecount&quot;&gt; &lt;img alt=&quot;&quot; src=&quot;https://assets.uvcdn.com/pkg/oembed/votes-091211c9006da8621310a57b963f98502e22c56c4202c61f55909e9bf3689818.png&quot; /&gt;7831 votes&lt;/div&gt; &lt;li&gt;&lt;li&gt; &lt;div class=&quot;uv-card-comments&quot;&gt; &lt;img alt=&quot;&quot; src=&quot;https://assets.uvcdn.com/pkg/oembed/comments-29b68afad19ca16ed6c50416e3ab6570e5df8c9f035d0bdcb08a442830bb718a.png&quot; /&gt;        925 comments&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;h2 class=&quot;uv-card-title&quot;&gt;&lt;a href=&quot;https://todo.uservoice.com/forums/597175-feature-suggestions/suggestions/18983857-folder-support-group-lists&quot;&gt;Folder support / Group lists&lt;/a&gt;&lt;/h2&gt;&lt;div class=&quot;uv-card-description&quot;&gt; &lt;p&gt;&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://todo.uservoice.com/forums/597175-feature-suggestions/suggestions/18983857-folder-support-group-lists&quot;&gt;todo.uservoice.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="ツール" label="ツール" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/26006613394849583/1565708674" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>WSLインストール環境設定メモ</title>
        <link href="https://blog.jhashimoto.net/entry/2019/08/04/114351"/>
        <id>hatenablog://entry/26006613386276707</id>
        <published>2019-08-04T11:43:51+09:00</published>
        <updated>2019-08-04T02:43:51+09:00</updated>        <summary type="html">WSLの環境構築のメモ。 WSLインストール [プログラムと機能の追加]からWindows Subsystem for Linuxをインストール Ubuntuインストール ストアからインストール ls配色 www.kwbtblog.com AWS CLI sudo apt install python3-pip pip3 install awscli --upgrade --user j-hashimoto@PC-02-280:~$ aws --version -bash: /mnt/c/Users/XXXX/AppData/Local/Programs/Python/Python36/Scr…</summary>
        <content type="html">&lt;p&gt;WSLの環境構築のメモ。&lt;/p&gt;

&lt;h2&gt;WSLインストール&lt;/h2&gt;

&lt;p&gt;[プログラムと機能の追加]から&lt;code&gt;Windows Subsystem for Linux&lt;/code&gt;をインストール&lt;/p&gt;

&lt;h2&gt;Ubuntuインストール&lt;/h2&gt;

&lt;p&gt;ストアからインストール&lt;/p&gt;

&lt;h2&gt;ls配色&lt;/h2&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.kwbtblog.com%2Fentry%2F2019%2F04%2F27%2F023411&quot; title=&quot;WSLのWindowsのフォルダの色が見づらいのを直す - 新しいことにはウェルカム&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://www.kwbtblog.com/entry/2019/04/27/023411&quot;&gt;www.kwbtblog.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;h2&gt;AWS CLI&lt;/h2&gt;

&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;sudo apt install python3-pip
pip3 install awscli --upgrade --user&lt;/pre&gt;




&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;j-hashimoto@PC-02-280:~$ aws --version                                                                                  
-bash: /mnt/c/Users/XXXX/AppData/Local/Programs/Python/Python36/Scripts/aws: c:\users\xxxx\appdata\local\programs\python\python36\python.exe^M: bad interpreter: No such file or directory&lt;/pre&gt;


&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fgokigenmaru.hatenablog.com%2Fentry%2F2018%2F12%2F07%2F142347&quot; title=&quot;Windows10 WSL(Ubuntu18.04)でawscliをインストールしてみた - gokigenmaruのブログ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://gokigenmaru.hatenablog.com/entry/2018/12/07/142347&quot;&gt;gokigenmaru.hatenablog.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="WSL" label="WSL" />
        
        <category term="Linux" label="Linux" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/26006613386276707/1567406024" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
    <entry>
        <title>viエディタTips</title>
        <link href="https://blog.jhashimoto.net/entry/2019/08/04/103451"/>
        <id>hatenablog://entry/26006613386205886</id>
        <published>2019-08-04T10:34:51+09:00</published>
        <updated>2019-08-04T01:34:51+09:00</updated>        <summary type="html">最近Linuxを使い始めたが、すぐ忘れるのでメモ。随時追記します。</summary>
        <content type="html">&lt;p&gt;最近Linuxを使い始めたが、すぐ忘れるのでメモ。随時追記します。&lt;/p&gt;

&lt;h2&gt;保存して終了&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/wq&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;検索&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/文字列&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;指定の行へ移動&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/行番号&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;行コピー&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/yy&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;ペースト&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/p&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;行削除（バッファにコピー）&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/dd&lt;/code&gt;&lt;/p&gt;
</content>        
        <category term="vi" label="vi" />
        
        <category term="Tips" label="Tips" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/26006613386205886/1577151631" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>【PostgreSQL】データベースのグローバルな設定を変更する</title>
        <link href="https://blog.jhashimoto.net/entry/2019/07/18/181820"/>
        <id>hatenablog://entry/17680117127220197481</id>
        <published>2019-07-18T18:18:20+09:00</published>
        <updated>2019-07-18T09:18:20+09:00</updated>        <summary type="html">SELECT current_setting(&#39;hoge&#39;)で取得する値を変更したい。</summary>
        <content type="html">&lt;p&gt;&lt;code&gt;SELECT current_setting(&#39;hoge&#39;)&lt;/code&gt;で取得する値を変更したい。&lt;/p&gt;

&lt;h2&gt;set_config&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;set_config(setting_name, new_value, is_local)&lt;/code&gt;を実行したが、変更が反映されなかった。set_configによる変更のスコープはセッション単位であるため。&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;SETでセッション内でローカルに変更できるパラメータの値を変更することができます。対応する関数はset_config(setting_name, new_value, is_local)です。&lt;/p&gt;&lt;/blockquote&gt;

&lt;h2&gt;ALTER DATABASE&lt;/h2&gt;

&lt;p&gt;ALTER DATABASEを使用すると、変更が永続化される（データベース単位のグローバルな設定値が変更される）。&lt;/p&gt;

&lt;pre class=&quot;code lang-sql&quot; data-lang=&quot;sql&quot; data-unlink&gt;&lt;span class=&quot;synStatement&quot;&gt;ALTER&lt;/span&gt; DATABASE db_name &lt;span class=&quot;synStatement&quot;&gt;SET&lt;/span&gt; setting_name &lt;span class=&quot;synSpecial&quot;&gt;TO&lt;/span&gt; new_value
&lt;/pre&gt;


&lt;blockquote&gt;&lt;p&gt;PostgreSQLは3つのSQLコマンドでデフォルト値を設定します。 すでに説明したALTER SYSTEMコマンドは、SQLによってグローバルな設定値を変更する方法を提供します; postgresql.confを編集するのと等価です。これに加え、データベース単位あるいはロール単位で設定するためのコマンドがあります:&lt;/p&gt;

&lt;p&gt;ALTER DATABASEコマンドはデータベース単位でグローバルな設定値を上書きします。&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;ちなみに、サーバーのデフォルト値を変更する場合は、&lt;code&gt;ALTER SYSTEM&lt;/code&gt;またはpostgresql.confを編集する。&lt;/p&gt;

&lt;h2&gt;参考&lt;/h2&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.postgresql.jp%2Fdocument%2F10%2Fhtml%2Fconfig-setting.html&quot; title=&quot;19.1. パラメータの設定&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://www.postgresql.jp/document/10/html/config-setting.html&quot;&gt;www.postgresql.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="PostgreSQL" label="PostgreSQL" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/17680117127220197481/1563441662" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>.NET Frameworkのアップグレードによる影響を知りたい</title>
        <link href="https://blog.jhashimoto.net/entry/2019/07/11/203244"/>
        <id>hatenablog://entry/17680117127216809085</id>
        <published>2019-07-11T20:32:44+09:00</published>
        <updated>2019-07-11T11:32:44+09:00</updated>        <summary type="html">.NET 4.6.1と4.6.2の差異が知りたい🤔#.NET— jhashimoto (@JHashimoto0518) July 9, 2019</summary>
        <content type="html">&lt;p&gt;&lt;blockquote class=&quot;twitter-tweet&quot; data-lang=&quot;HASH(0x556b899eacd0)&quot;&gt;&lt;p lang=&quot;ja&quot; dir=&quot;ltr&quot;&gt;.NET 4.6.1と4.6.2の差異が知りたい🤔&lt;br&gt;#.NET&lt;/p&gt;&amp;mdash; jhashimoto (@JHashimoto0518) &lt;a href=&quot;https://twitter.com/JHashimoto0518/status/1148455793991094272?ref_src=twsrc%5Etfw&quot;&gt;July 9, 2019&lt;/a&gt;&lt;/blockquote&gt;&lt;script async src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;&lt;/p&gt;

&lt;p&gt;このサイトが便利。&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdocs.microsoft.com%2Fja-jp%2Fdotnet%2Fframework%2Fmigration-guide%2Fretargeting%2F&quot; title=&quot;.NET Framework における再ターゲットの変更点&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://docs.microsoft.com/ja-jp/dotnet/framework/migration-guide/retargeting/&quot;&gt;docs.microsoft.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;現在のバージョンと移行先のバージョンを指定します。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20190711/20190711202336.png&quot; alt=&quot;f:id:JHashimoto:20190711202336p:plain&quot; title=&quot;f:id:JHashimoto:20190711202336p:plain&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;変更点が確認できます。&lt;/p&gt;

&lt;p&gt;&lt;span itemscope itemtype=&quot;http://schema.org/Photograph&quot;&gt;&lt;img src=&quot;https://cdn-ak.f.st-hatena.com/images/fotolife/J/JHashimoto/20190711/20190711202832.png&quot; alt=&quot;f:id:JHashimoto:20190711202832p:plain&quot; title=&quot;f:id:JHashimoto:20190711202832p:plain&quot; class=&quot;hatena-fotolife&quot; itemprop=&quot;image&quot;&gt;&lt;/span&gt;&lt;/p&gt;
</content>        
        <category term=".NET" label=".NET" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/17680117127216809085/1562846478" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
    <entry>
        <title>【ASP.NET】compilation要素とhttpRuntime要素のtargetFrameworkプロパティの使い分け</title>
        <link href="https://blog.jhashimoto.net/entry/2019/07/11/201821"/>
        <id>hatenablog://entry/17680117127216802306</id>
        <published>2019-07-11T20:18:21+09:00</published>
        <updated>2019-07-11T11:18:21+09:00</updated>        <summary type="html">.NET3.5のASP.NETアプリを.NET4.6にアップグレードした。</summary>
        <content type="html">&lt;p&gt;.NET3.5のASP.NETアプリを.NET4.6にアップグレードした。&lt;/p&gt;

&lt;pre class=&quot;code lang-xml&quot; data-lang=&quot;xml&quot; data-unlink&gt;&lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;system&lt;/span&gt;&lt;span class=&quot;synComment&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;web&amp;gt;&lt;/span&gt; 
    &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;compilation &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;debug&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;targetFramework&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;4.6&amp;quot;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; /&amp;gt;&lt;/span&gt; 
    &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;httpRuntime &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;targetFramework&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;4.6&amp;quot;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; /&amp;gt;&lt;/span&gt; 
&lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;/system&lt;/span&gt;&lt;span class=&quot;synComment&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;web&amp;gt;&lt;/span&gt; 
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;compilation&lt;/code&gt;要素と&lt;code&gt;httpRuntime&lt;/code&gt;要素の&lt;code&gt;targetFramework&lt;/code&gt;プロパティの使い分け。&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;compilation要素のtargetFrameworkプロパティは、ビルド時に参照される.NETFrameworkのバージョン。&lt;/li&gt;
&lt;li&gt;httpRuntime要素のtargetFrameworkプロパティは、実行時に参照される.NETFrameworkのバージョン。

&lt;ul&gt;
&lt;li&gt;exeの場合は、app.configのsupportedRuntime要素で指定できるが、ASP.NETはapp.configが使えないので、httpRuntime要素を使用する。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;参考&lt;/h3&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fstackoverrun.com%2Fja%2Fq%2F11062818&quot; title=&quot;ASP .NET MVCのweb.configでTargetFramework設定が意味することは何ですか？私たちのASP.NET MVC 5 Webアプリケーションの&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://stackoverrun.com/ja/q/11062818&quot;&gt;stackoverrun.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdevblogs.microsoft.com%2Faspnet%2Fall-about-httpruntime-targetframework%2F&quot; title=&quot;ASP.NET Blog | All about&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://devblogs.microsoft.com/aspnet/all-about-httpruntime-targetframework/&quot;&gt;devblogs.microsoft.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fcodeday.me%2Fjp%2Fqa%2F20190513%2F818463.html&quot; title=&quot;c＃ – ASP.NET MVC 5のweb.configコンパイルとhttpRuntimeエラー - コードログ&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://codeday.me/jp/qa/20190513/818463.html&quot;&gt;codeday.me&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdocs.microsoft.com%2Fja-jp%2Fvisualstudio%2Fide%2Fhow-to-target-a-version-of-the-dotnet-framework%3Fview%3Dvs-2015&quot; title=&quot;方法: .NET Framework のバージョンを対象 - Visual Studio 2015&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://docs.microsoft.com/ja-jp/visualstudio/ide/how-to-target-a-version-of-the-dotnet-framework?view=vs-2015&quot;&gt;docs.microsoft.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fopentouryo.osscons.jp%2Findex.php%3FtargetFramework%25E3%2581%25AE%25E3%2583%2590%25E3%2583%25BC%25E3%2582%25B8%25E3%2583%25A7%25E3%2583%25B3%25E3%2582%25A2%25E3%2583%2583%25E3%2583%2597&quot; title=&quot;targetFrameworkのバージョンアップ - Open 棟梁 Wiki&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://opentouryo.osscons.jp/index.php?targetFramework%E3%81%AE%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%82%A2%E3%83%83%E3%83%97&quot;&gt;opentouryo.osscons.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="ASP.NET" label="ASP.NET" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/17680117127216802306/1562843901" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>RedshiftのよくあるTips</title>
        <link href="https://blog.jhashimoto.net/entry/2019/06/20/214109"/>
        <id>hatenablog://entry/17680117127203810436</id>
        <published>2019-06-20T21:41:09+09:00</published>
        <updated>2019-06-20T12:41:09+09:00</updated>        <summary type="html">RedshiftのよくあるTipsです。随時更新します。</summary>
        <content type="html">&lt;p&gt;RedshiftのよくあるTipsです。随時更新します。&lt;/p&gt;

&lt;h3&gt;テーブルの分散キーとソートキーを確認したい&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;fooSchama&lt;/code&gt;に&lt;code&gt;barTable&lt;/code&gt;があるとして、&lt;/p&gt;

&lt;pre class=&quot;code lang-sql&quot; data-lang=&quot;sql&quot; data-unlink&gt;&lt;span class=&quot;synComment&quot;&gt;-- 検索パスにスキーマを追加する（セッション内で有効）&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;set&lt;/span&gt; search_path &lt;span class=&quot;synSpecial&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;$user&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;, &lt;span class=&quot;synSpecial&quot;&gt;public&lt;/span&gt;, &lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;fooSchama&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;;

&lt;span class=&quot;synStatement&quot;&gt;SELECT&lt;/span&gt; * &lt;span class=&quot;synSpecial&quot;&gt;FROM&lt;/span&gt; pg_table_def &lt;span class=&quot;synSpecial&quot;&gt;WHERE&lt;/span&gt; schemaname = &lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;fooSchama&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;AND&lt;/span&gt; tablename = &lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;barTable&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;AND&lt;/span&gt; (distkey = &lt;span class=&quot;synSpecial&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;OR&lt;/span&gt; sortkey &amp;gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;);
&lt;/pre&gt;


&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdev.classmethod.jp%2Fcloud%2Faws%2Fredshift-system-view-sql%2F&quot; title=&quot;Amazon Redshiftのシステムテーブルを見る時によく使うSQL ９選 | DevelopersIO&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://dev.classmethod.jp/cloud/aws/redshift-system-view-sql/&quot;&gt;dev.classmethod.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;h3&gt;エクスポートするCSVにヘッダを付けたい&lt;/h3&gt;

&lt;p&gt;UNLOADでHEADERオプションを指定します。&lt;/p&gt;

&lt;p&gt;HEADERオプションがサポートされる前は、こんなSQLを書く必要がありました。&lt;/p&gt;

&lt;pre class=&quot;code lang-sql&quot; data-lang=&quot;sql&quot; data-unlink&gt;UNLOAD (
    &lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;SELECT&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        column1,&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        column2,&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        column3&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    FROM (&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        SELECT&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;column1&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; AS column1,&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;column2&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; AS column2,&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;column3&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; AS column3&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;            1 as row_num&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        WHERE 1 = 1&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        UNION ALL&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        SELECT&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;            CAST(column1 AS VARCHAR) AS column1,&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;            CAST(column2 AS VARCHAR) AS column2,&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;            CAST(column3 AS VARCHAR) AS column3,&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;            2 as row_rum&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;        FROM fooSchema.barTable&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;    ) T ORDER BY row_num)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;TO &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;s3://bucketname/filename&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;CREDENTIALS &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;credentials&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;;&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;HEADERオプションを使うとシンプルに書けます。&lt;/p&gt;

&lt;pre class=&quot;code lang-sql&quot; data-lang=&quot;sql&quot; data-unlink&gt;UNLOAD (&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;SELECT * FROM fooSchema.barTable)&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;TO &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;s3://bucketname/filename&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;CREDENTIALS &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;credentials&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;HEADER;&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdev.classmethod.jp%2Fcloud%2Faws%2F20181016-amazon-redshift-unload-support-header-option%2F%23toc--header&quot; title=&quot;Amazon Redshift これでデータレイクの連携がスムーズになる！ UNLOADコマンドがヘッダー行に対応したので試してみました | DevelopersIO&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://dev.classmethod.jp/cloud/aws/20181016-amazon-redshift-unload-support-header-option/#toc--header&quot;&gt;dev.classmethod.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;h3&gt;キャッシュを無効化したい&lt;/h3&gt;

&lt;p&gt;パフォーマンステストで必須です。&lt;/p&gt;

&lt;blockquote cite=&quot;https://yohei-a.hatenablog.jp/entry/20180225/1519540121&quot; data-uuid=&quot;17680117127205811745&quot;&gt;&lt;p&gt;セッションレベルで無効化する方法 set enable_result_cache_for_session=off; ユーザーレベルで無効化する方法 ALTER USER awsuser SET enable_result_cache_for_session = off;&lt;/p&gt;&lt;cite&gt;&lt;a href=&quot;https://yohei-a.hatenablog.jp/entry/20180225/1519540121&quot;&gt;Redshift のリザルトキャッシュを無効化する方法 - ablog&lt;/a&gt;&lt;/cite&gt;&lt;/blockquote&gt;


&lt;h4&gt;検証&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;SELECT * FROM tableName LIMIT 1&lt;/code&gt;の結果セットがキャッシュされたものか？&lt;/p&gt;

&lt;pre class=&quot;code lang-sql&quot; data-lang=&quot;sql&quot; data-unlink&gt;&lt;span class=&quot;synStatement&quot;&gt;SELECT&lt;/span&gt; * &lt;span class=&quot;synSpecial&quot;&gt;FROM&lt;/span&gt; SVL_QLOG &lt;span class=&quot;synSpecial&quot;&gt;WHERE&lt;/span&gt; substring = &lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;SELECT * FROM tableName LIMIT 1&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&#39;&lt;/span&gt;;
&lt;/pre&gt;


&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt; userid    &lt;/th&gt;
&lt;th&gt; query     &lt;/th&gt;
&lt;th&gt; xid   &lt;/th&gt;
&lt;th&gt; pid   &lt;/th&gt;
&lt;th&gt; starttime     &lt;/th&gt;
&lt;th&gt; endtime   &lt;/th&gt;
&lt;th&gt; elapsed   &lt;/th&gt;
&lt;th&gt; aborted   &lt;/th&gt;
&lt;th&gt; label     &lt;/th&gt;
&lt;th&gt; substring     &lt;/th&gt;
&lt;th&gt; source_query  &lt;/th&gt;
&lt;th&gt; concurrency_scaling_status_txt    &lt;/th&gt;
&lt;th&gt; from_sp_call  &lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt; 112   &lt;/td&gt;
&lt;td&gt; 3901  &lt;/td&gt;
&lt;td&gt; 12973817  &lt;/td&gt;
&lt;td&gt; 31495     &lt;/td&gt;
&lt;td&gt; 2019/6/24 4:44    &lt;/td&gt;
&lt;td&gt; 2019/6/24 4:44    &lt;/td&gt;
&lt;td&gt; 8892  &lt;/td&gt;
&lt;td&gt; 0     &lt;/td&gt;
&lt;td&gt; default   &lt;/td&gt;
&lt;td&gt; SELECT * FROM tableName LIMIT 1   &lt;/td&gt;
&lt;td&gt;   &lt;/td&gt;
&lt;td&gt; 0 - Ran on the main cluster   &lt;/td&gt;
&lt;td&gt;   &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;p&gt;&lt;code&gt;source_query&lt;/code&gt;がNullなので、キャッシュされていない。&lt;/p&gt;

&lt;h3&gt;ユーザーにテーブル権限を付与したい&lt;/h3&gt;

&lt;pre class=&quot;code lang-sql&quot; data-lang=&quot;sql&quot; data-unlink&gt;&lt;span class=&quot;synComment&quot;&gt;-- スキーマへのALL権限&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;ALL&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;ON&lt;/span&gt; SCHEMA schemaName &lt;span class=&quot;synSpecial&quot;&gt;TO&lt;/span&gt; userName;

&lt;span class=&quot;synComment&quot;&gt;-- スキーマの既存テーブルへのALL権限&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;ALL&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;ALL&lt;/span&gt; TABLES &lt;span class=&quot;synStatement&quot;&gt;IN&lt;/span&gt; SCHEMA schemaName &lt;span class=&quot;synSpecial&quot;&gt;TO&lt;/span&gt; userName;

&lt;span class=&quot;synComment&quot;&gt;-- デフォルト権限を設定して、新たに作成されたテーブルをreadOnlyUserNameが参照可能にする&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;ALTER&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;PRIVILEGES&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;IN&lt;/span&gt; SCHEMA schemaName &lt;span class=&quot;synStatement&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;ON&lt;/span&gt; TABLES &lt;span class=&quot;synSpecial&quot;&gt;TO&lt;/span&gt; readOnlyUserName;
&lt;/pre&gt;


&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdev.classmethod.jp%2Fcloud%2Faws%2Famazon-redshift-grant-and-revoke-on-all-tables-in-schema%2F&quot; title=&quot;Amazon Redshift: テーブル権限付与設定(GRANT/REVOKE)がON ALL TABLES IN SCHEMA指定で一括実行出来る様になりました | DevelopersIO&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://dev.classmethod.jp/cloud/aws/amazon-redshift-grant-and-revoke-on-all-tables-in-schema/&quot;&gt;dev.classmethod.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdev.classmethod.jp%2Fcloud%2Fredshift-alter-default-privileges%2F&quot; title=&quot;Redshiftのデフォルト権限設定でハマったこと | DevelopersIO&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://dev.classmethod.jp/cloud/redshift-alter-default-privileges/&quot;&gt;dev.classmethod.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;h3&gt;ユーザーの実行権限確認&lt;/h3&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdev.classmethod.jp%2Fcloud%2Faws%2Famazon-redshift-useful-sql-access-privileges%2F&quot; title=&quot;Amazon Redshift Useful SQL: テーブル別実行権限設定の一覧をもう少し分かり易く表示する | DevelopersIO&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://dev.classmethod.jp/cloud/aws/amazon-redshift-useful-sql-access-privileges/&quot;&gt;dev.classmethod.jp&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;h3&gt;テーブルの分散キー確認&lt;/h3&gt;

&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;SELECT &amp;#34;schema&amp;#34;, &amp;#34;table&amp;#34;, diststyle FROM SVV_TABLE_INFO&lt;/pre&gt;


&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdocs.aws.amazon.com%2Fja_jp%2Fredshift%2Flatest%2Fdg%2Fviewing-distribution-styles.html&quot; title=&quot;分散スタイルの表示 - Amazon Redshift&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://docs.aws.amazon.com/ja_jp/redshift/latest/dg/viewing-distribution-styles.html&quot;&gt;docs.aws.amazon.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="Redshift" label="Redshift" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/17680117127203810436/1567650819" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>Gitチートシート</title>
        <link href="https://blog.jhashimoto.net/entry/2019/06/18/115925"/>
        <id>hatenablog://entry/17680117127202481725</id>
        <published>2019-06-18T11:59:25+09:00</published>
        <updated>2019-06-18T02:59:25+09:00</updated>        <summary type="html">随時更新します。</summary>
        <content type="html">&lt;p&gt;随時更新します。&lt;/p&gt;

&lt;h3&gt;基本操作&lt;/h3&gt;

&lt;h4&gt;ブランチを作成したい&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git branch [name]
git branch [name] [ハッシュ] // コミットを指定してブランチ作成
&lt;/pre&gt;


&lt;h4&gt;ブランチ移動&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git checkout
git checkout -b [name] // ブランチの作成と移動を同時にやる
&lt;/pre&gt;


&lt;h4&gt;コミット移動&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git reset             // 指定のコミットまで戻る。作業ファイルはそのまま
git reset --hard  // 作業ファイルの変更も元に戻る。注意！！
&lt;/pre&gt;


&lt;h4&gt;リモートリポジトリを追加&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git remote add origin [url]
&lt;/pre&gt;


&lt;h4&gt;リモートリポジトリを確認&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;$ git remote -v
&lt;/pre&gt;


&lt;h4&gt;変更をプッシュしたい&lt;/h4&gt;

&lt;pre class=&quot;code lang-ps1&quot; data-lang=&quot;ps1&quot; data-unlink&gt;git push origin master    // originというリモートリポジトリのmasterというブランチにプッシュ
&lt;/pre&gt;


&lt;h5&gt;git pushで毎回パラメータを指定するのが面倒&lt;/h5&gt;

&lt;p&gt;&lt;code&gt;-u&lt;/code&gt;を指定すると、ローカルブランチがリモートブランチにリンクされます。次回以降は引数なしで&lt;code&gt;git push&lt;/code&gt;を実行できます。&lt;/p&gt;

&lt;pre class=&quot;code lang-ps1&quot; data-lang=&quot;ps1&quot; data-unlink&gt;git push -u origin master
&lt;/pre&gt;


&lt;h4&gt;リモートの更新を確認したい&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git fetch　// 更新情報を取得（ファイルは更新しない）
&lt;/pre&gt;


&lt;h4&gt;リモートの更新をマージしたい&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git merge origin/master // 更新をマージ。この例ではoriginが指すリポジトリのmasterブランチをマージ。
&lt;/pre&gt;


&lt;h4&gt;二つのcommit間の差分を出力したい&lt;/h4&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fqiita.com%2Fkasyuu%2Fitems%2Fbc8489831e200b641456&quot; title=&quot;gitでcommit間の差分を出力する - Qiita&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://qiita.com/kasyuu/items/bc8489831e200b641456&quot;&gt;qiita.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git diff &amp;lt;コミットハッシュ1&amp;gt; &amp;lt;コミットハッシュ2&amp;gt;
&lt;/pre&gt;


&lt;h4&gt;コミットのログを見たい&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git log
git log -p // ENTERを連続で押す、またはQで抜ける
&lt;/pre&gt;


&lt;h4&gt;コミットのログをグラフィカルに見たい&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git log --graph
&lt;/pre&gt;


&lt;h4&gt;ローカルの単一ファイルの変更を元に戻したい&lt;/h4&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git checkout some_filename
&lt;/pre&gt;


&lt;h3&gt;トラブルシュート&lt;/h3&gt;

&lt;h4&gt;コミットメッセージを間違えてしまった&lt;/h4&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.granfairs.com%2Fblog%2Fstaff%2Fgit-commit-fix&quot; title=&quot;Gitのコミットメッセージを後から変更する方法をわかりやすく書いてみた | 株式会社グランフェアズ&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://www.granfairs.com/blog/staff/git-commit-fix&quot;&gt;www.granfairs.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;h4&gt;クローンしたらdevelopブランチがない&lt;/h4&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fqiita.com%2Fshim0mura%2Fitems%2F85aa7fc762112189bd73&quot; title=&quot;リモートのブランチをcloneする - Qiita&quot; class=&quot;embed-card embed-webcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 155px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://qiita.com/shim0mura/items/85aa7fc762112189bd73&quot;&gt;qiita.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;で、git branchすればわかるんだけど、このままだとmasterブランチしかローカルにcloneできてない。別のブランチ(developmentとする)もローカルにcloneしたい。&lt;/p&gt;&lt;/blockquote&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git checkout -b development origin/development
&lt;/pre&gt;


&lt;h4&gt;git configの変更が反映されない&lt;/h4&gt;

&lt;p&gt;globalよりもlocalのエントリが優先されます。&lt;/p&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git config --global user.name John
git config --list | grep user.name
user.name=Thomas
&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;--show-origin&lt;/code&gt;でエントリのoriginを確認します。&lt;/p&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git config --list --show-origin | grep user.name
file:C:/Users/xxx/.gitconfig        user.name=John
file:.git/config        user.name=Thomas    // localが優先される
&lt;/pre&gt;


&lt;p&gt;globalのエントリを反映させたいなら、localのエントリを削除します。&lt;/p&gt;

&lt;pre class=&quot;code lang-git&quot; data-lang=&quot;git&quot; data-unlink&gt;git config --unset user.name
git config --list | grep user.name
user.name=John
&lt;/pre&gt;


&lt;h3&gt;その他&lt;/h3&gt;

&lt;h4&gt;gitignoreのテンプレートがほしい&lt;/h4&gt;

&lt;p&gt;&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhnw.hatenablog.com%2Fentry%2F20121221&quot; title=&quot;.gitignoreを作ってくれるgiboが便利すぎる - hnwの日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;&lt;cite class=&quot;hatena-citation&quot;&gt;&lt;a href=&quot;https://hnw.hatenablog.com/entry/20121221&quot;&gt;hnw.hatenablog.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>        
        <category term="Git" label="Git" />
        
        <category term="チートシート" label="チートシート" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/17680117127202481725/1580863038" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>【PostgreSQL】経過日数を取得する</title>
        <link href="https://blog.jhashimoto.net/entry/2019/02/08/160101"/>
        <id>hatenablog://entry/98012380861485868</id>
        <published>2019-02-08T16:01:01+09:00</published>
        <updated>2019-02-08T07:01:01+09:00</updated>        <summary type="html">PostgreSQLはDATEDIFFをサポートしていないので、調べました。</summary>
        <content type="html">&lt;p&gt;PostgreSQLはDATEDIFFをサポートしていないので、調べました。&lt;/p&gt;

&lt;h2&gt;テストデータ作成&lt;/h2&gt;

&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;CREATE TEMP TABLE test AS SELECT TIMESTAMP &amp;#39;2019-01-08 10:00:00&amp;#39; AS created_at;&lt;/pre&gt;


&lt;h2&gt;検証&lt;/h2&gt;

&lt;p&gt;TIMESTAMP型で引き算すると、INTERVAL型で結果を取得できます。&lt;/p&gt;

&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;SELECT CURRENT_TIMESTAMP - created_at AS elapsed FROM test;&lt;/pre&gt;




&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;30 days 20:52:11.601642&lt;/pre&gt;


&lt;p&gt;INTERVAL型から日数を取り出すには、EXTRACTを使います。&lt;/p&gt;

&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;SELECT EXTRACT(DAY FROM (CURRENT_TIMESTAMP - created_at)) AS elapsed FROM test&lt;/pre&gt;




&lt;pre class=&quot;code&quot; data-lang=&quot;&quot; data-unlink&gt;30&lt;/pre&gt;

</content>        
        <category term="PostgreSQL" label="PostgreSQL" />
        
        <category term="SQL" label="SQL" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/98012380861485868/1549610787" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>アーキテクチャ設計書の雛形がほしいときは？</title>
        <link href="https://blog.jhashimoto.net/entry/2019/01/28/110214"/>
        <id>hatenablog://entry/98012380843353299</id>
        <published>2019-01-28T11:02:14+09:00</published>
        <updated>2019-01-28T02:02:14+09:00</updated>        <summary type="html">architecture template filetype:docxで検索。</summary>
        <content type="html">&lt;p&gt;&lt;code&gt;architecture template filetype:docx&lt;/code&gt;で検索。&lt;/p&gt;
</content>        
        <category term="アーキテクチャ" label="アーキテクチャ" />
        
        <category term="ドキュメント" label="ドキュメント" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/98012380843353299/1548640934" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
    
    
    <entry>
        <title>【AWS Tools for Powershell】Data Pipelineの名前からパイプラインIDを取得する</title>
        <link href="https://blog.jhashimoto.net/entry/2019/01/27/105646"/>
        <id>hatenablog://entry/98012380841278032</id>
        <published>2019-01-27T10:56:46+09:00</published>
        <updated>2019-01-27T01:56:46+09:00</updated>        <summary type="html">動機 パイプラインIDはパイプラインを再作成（削除して作成）すると変わるので、パイプライン名から動的に取得したい。</summary>
        <content type="html">&lt;h2&gt;動機&lt;/h2&gt;

&lt;p&gt;パイプラインIDはパイプラインを再作成（削除して作成）すると変わるので、パイプライン名から動的に取得したい。&lt;/p&gt;

&lt;h2&gt;コード&lt;/h2&gt;

&lt;pre class=&quot;code lang-ps1&quot; data-lang=&quot;ps1&quot; data-unlink&gt;&lt;span class=&quot;synType&quot;&gt;[String[]]&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$pipelineIds&lt;/span&gt; = &lt;span class=&quot;synStatement&quot;&gt;Get-DPPipeline&lt;/span&gt; -ProfileName &lt;span class=&quot;synIdentifier&quot;&gt;$profile&lt;/span&gt; | &lt;span class=&quot;synStatement&quot;&gt;Where-Object&lt;/span&gt; -&lt;span class=&quot;synStatement&quot;&gt;EQ&lt;/span&gt; name &lt;span class=&quot;synIdentifier&quot;&gt;$pipelineName&lt;/span&gt; | &lt;span class=&quot;synStatement&quot;&gt;Select-Object&lt;/span&gt; -ExpandProperty Id
&lt;/pre&gt;

</content>        
        <category term="AWS Tools for PowerShell" label="AWS Tools for PowerShell" />
        
        <category term="AWS Data Pipeline" label="AWS Data Pipeline" />
        
        <link rel="enclosure" href="https://ogimage.blog.st-hatena.com/12921228815716984990/98012380841278032/1548554206" type="image/png" length="0" />

        <author>
            <name>JHashimoto</name>
        </author>
    </entry>
    
  
</feed>
