Flushing dns caching in linux

Problem

You want to update your dns resolution locally after some change in DNS.

You want to do this because your local dns cache still holds the old information about the domain. For example using your local dns and the google one returns two different results

host changed_domain.com
returns the old ip

host changed_domain.com 8.8.8.8
returns the new ip.

Solution

Check your systemd-resolved is active:

sudo systemctl is-active systemd-resolved
active

Get some statistics:

sudo systemd-resolve --statistics

Transactions
Current Transactions: 0
  Total Transactions: 38818

Cache
  Current Cache Size: 73
          Cache Hits: 21120
        Cache Misses: 19745

DNSSEC Verdicts
              Secure: 0
            Insecure: 0
               Bogus: 0
       Indeterminate: 0

Flush the cache (make the Current Cache Size above 0)

sudo systemd-resolve --flush-caches

Check the cache again (should be 0 now):

sudo systemd-resolve --statistics

ransactions
Current Transactions: 0
  Total Transactions: 38818

Cache
  Current Cache Size: 0
          Cache Hits: 21120
        Cache Misses: 19745

DNSSEC Verdicts
              Secure: 0
            Insecure: 0
               Bogus: 0
       Indeterminate: 0

Information taken from https://www.techrepublic.com/article/how-to-flush-the-dns-cache-on-linux/

Using exo cli to display your vm templates in Exoscale

To display your vm templates, as opposed to all available templates in Exoscale using the exo CLI, use the following (you should have already the environment variables set up to be able to use exo):

exo vm template list --mine
?????????????????????????????????????????????????????????????????????????????????????????????????????????
?                  ID                  ?     NAME      ?      CREATION DATE       ?  ZONE   ? DISK SIZE ?
?????????????????????????????????????????????????????????????????????????????????????????????????????????
? a58f0180-689d-4663-aa53-91111111111  ? my-ubuntu     ? 2020-08-12T13:44:01+0000 ? ch-dk-2 ? 50 GiB    ?
?????????????????????????????????????????????????????????????????????????????????????????????????????????

WARNING: Pulling GitLab Runner helper image from Docker Hub. Helper image is migrating to registry.gitlab.com, for more information see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#migrating-helper-image-to-registrygitlabcom

To change this in your gitlab-runner configuration, depends on the version of your gitlab-runner as described in https://docs.gitlab.com/runner/configuration/feature-flags.html

If you version is 13.9.0 (gitlab-runner –version), then add the following in ~/.gitlab-runner/config.toml

[[runners]]
  name = "gitlab-runner-name"
  request_concurrency = 1
  url = "https://git.url.test/"
  token = "xckaxxxxxxxx"
  executor = "kubernetes"
  environment = ["FF_GITLAB_REGISTRY_HELPER_IMAGE=1"]

Error: Invalid provider configuration (terraform plan locally with TerraformCloud)

Problem

You are trying to run locally the terraform plan, while using the Terraform’s Cloud remote backend, before commiting your changes to your repo and running it through Terraform’s Cloud UI, and you are getting the previous error message:

Error: Invalid provider configuration

Solution

Remember to add the environment variables needed for your provider (AWS, Google, Exoscale etc) in the Variables section of your Terraform Cloud setup.

Even you have added them before, using a new Workspace means you will need to add them to each new workspace.

asdf and terraform (or vault or packer)

Using the asdf version manager to manage versions of various binaries like terraform, vault or packer is easily done by following the instructions below:

  1. Download and install asdf if you haven’t got it already (https://asdf-vm.com/#/core-manage-asdf)
  2. If you want to install the latest version of terraform for example do the following:
asdf plugin add terraform
asdf install terraform latest
asdf global terraform 0.14.9
asdf list
terraform
  0.14.9
terraform --version
Terraform v0.14.9