Sunday, March 31, 2024

diigo.to.shak.blogspot.dailiy. 03/31/2024

    • Follow these steps to set up a Remote Desktop Protocol (RDP) connection from your local machine to an   Amazon Linux 2 instance running the MATE desktop environment.
    • Reconnect to the instance and run the following command on your Linux instance   to set the password for ec2-user.
    • First, start the xrdp service. You should be able to connect an RDP client to the host on the default RDP port (3389). If successful, you will be greeted with the xrdp session manager window which allows you to choose between Xorg or Xvnc sessions and provides inputs for user authentication. The session manager UI can be highly customized by modifying /etc/xrdp/xrdp.ini

      The parameters used to start Xorg and Xvnc display servers can be configured in /etc/xrdp/sesman.ini

      After successfully starting a display server, xrdp will execute /etc/xrdp/startwm.sh by default. This script is meant to start a window manager (similar to .xinitrc) and will read from ~/.xinitrc or /etc/X11/xinit/xinitrc if they exist. It is recommended to edit ~/.xinitrc to start your desktop environment or window manager, but you can also edit /etc/xrdp/startwm.sh

      If you just close the session window and RDP connection, you can access the same session again next time you connect with RDP. When you exit the window manager or desktop environment from the session window, the session will close and a new session will be opened the next time.

    • The required_providers block must be nested inside the top-level terraform block (which can also contain other settings).
    • Each module should at least declare the minimum provider version it is known to work with, using the >= version constraint syntax:
    • If you created a password for your user account when you created your VM, skip this step. If you only use SSH key authentication and don't have a local account password set, specify a password before you use xrdp to log in to your VM. xrdp can't accept SSH keys for authentication. The following example specifies a password for the user account azureuser:
    • Specifying a password does not update your SSHD configuration to permit password logins if it currently does not. From a security perspective, you may wish to connect to your VM with an SSH tunnel using key-based authentication and then connect to xrdp.

Posted from Diigo. The rest of my favorite links are here.

Friday, March 29, 2024

diigo.to.shak.blogspot.dailiy. 03/29/2024

    • In this example, I have used the AWS S3 bucket as the remote backend.
    • When we look at the contents of the Terraform state S3 bucket, apart from our default terraform.tfstate file, we can see that a new directory named “env:/” is created, within which another directory with the name of our workspace (test_workspace) is created. A new terraform.tfstate file is maintained at this location.
    • Looking closely, the size of the default state file is considerably larger than that of the custom workspace-specific state file. This shows that the new state file is created, but it does not hold any information from the default state file. This is how Terraform creates an isolated environment and maintains its state file differently.

       

      The contents of the test_workspace state file before running terraform apply are shown below:

      • When you practice infrastructure-as-code (IaC), e.g., using terraform, there are 3 types of “infrastructure state”

        • infrastructure state described by the terraform DSL (Domain Specific-Language) configuration files”: This is the outcome of a devops codifying the infrastructure in a bunch of files
        • actual infrastructure state”: This is the actual infrastructure, which is the result of using terraform to deploy the infrastructure codified in the “terraform DSL configuration files” from the previous step
        • terraform state file”: This an artifact generated by the terraform deployment. It holds information that is otherwise not available anywhere else; it maps the infrastructure components codified in the “terraform DSL configuration files” to the actual manifested infrastructure components. This is usually stored in central store, e.g., AWS S3, etc., accessible to all terraform users so that everyone sees the same state, and it can be locked to prevent simultaneous changes, to avoid state corruption.
    • Comparing ‘terraform plan/apply -refresh-only (refresh)’, ‘terraform plan’, ‘terraform apply’ and their impact
    • ~>: Allows only the rightmost version component to increment. For example, to allow new patch releases within a specific minor release, use the full version number: ~> 1.0.4 will allow installation of 1.0.5 and 1.0.10 but not 1.1.0

Posted from Diigo. The rest of my favorite links are here.

Wednesday, March 27, 2024

diigo.to.shak.blogspot.dailiy. 03/27/2024

Posted from Diigo. The rest of my favorite links are here.

Tuesday, March 26, 2024

diigo.to.shak.blogspot.dailiy. 03/26/2024

    • Note that even when TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled.
      • For all terraform commands that involves states, e.g., plan, apply, refresh (deprecated and is now '-refresh-only'), it is useful to think about it in terms of 2 things:

         
           
        • The authoritative state
        •  
        • The states being compared Note that the 'authoritative state' is NEVER changed as a result of the command.
        •  
         

        There are 3 types of 'state' (loosely):

         
           
        • Actual state of your infra (actual-state)
        •  
        • terraform state file (tf-state-file)
        •  
        • State described by terraform code config (tf-dsl-config)
        •  
         

        When you do terraform plan/apply WITH -refresh-only:

         
           
        • The authoritative state is 'actual-state'
        •  
        • The states being compared in 'terraform plan -refresh-only' is 'actual-state' vs. 'tf-state-file'
        •  
        • The outcome of 'terraform apply -refresh-only' is 'tf-state-file' is synced to become 'actual-state'
        •  
         

        When you do terraform plan/apply WITHOUT -refresh-only:

         
           
        • The authoritative state is 'tf-dsl-config'
        •  
        • The states being compared in 'terraform plan' is 'tf-dsl-config' vs. 'actual-state'
        •  
        • The outcome of 'terraform apply' is 'actual-state' is synced to become 'tf-dsl-config'
        •  
         

        For more details of what authoritative states are, and what states are being compared for various terraform commands see:

Posted from Diigo. The rest of my favorite links are here.

Saturday, March 23, 2024

diigo.to.shak.blogspot.dailiy. 03/23/2024

Posted from Diigo. The rest of my favorite links are here.

Friday, March 22, 2024

diigo.to.shak.blogspot.dailiy. 03/22/2024

Posted from Diigo. The rest of my favorite links are here.

Shak.blog.notes 08/20/2024

Thinking Like an Architect - InfoQ tags: blog ...