• git: merge changes to a branch on a different remote

    2 min read

    It is quite common to have have several remote repositories, let's see how to merge a change to a branch on a remote that collides with one of our local branches.

    28/12/2020

    Read more...
  • terraform: Append to a list using concat

    2 min read

    terraform append list concat HCL conditionally append

    To be able to conditionally append objects (or strings) to a list in terraform we must put it in another way: How do we dynamically generate a list of objects?

    The answer is using we can use the concat() function

    result = concat(["A"], ["B"])
    

    24/12/2020

    Read more...
  • Managing a secret on kubernetes

    3 min read

    secret password kubernetes kubectl k8s

    Most of the services we will be deploying on kubernetes are going to rely on having access to secrets to retrieve or push data to another service: Let's check how to work with the secrets on kubernetes

    $ kubectl create secret
    Create a secret using specified subcommand.
    
    Available Commands:
      docker-registry Create a secret for use with a Docker registry
      generic         Create a secret from a local file, directory or literal value
      tls             Create a TLS secret
    
    Usage:
      kubectl create secret [flags] [options]
    
    Use "kubectl <command> --help" for more information about a given command.
    Use "kubectl options" for a list of global command-line options (applies to all commands).
    

    23/12/2020

    Read more...
  • Change kubectl context to use another k8s cluster

    2 min read

    kubernetes kubectl context

    When you have on your .kube/config several clusters, you can choose to which cluster you want to connect by setting the appropriate context.

    22/12/2020

    Read more...
  • Unlocking remote terraform state

    2 min read

    terraform S3 bucket unlock tfstate force-unlock

    When you are working with the terraform state on a S3 bucket if you cancel an operation you might end up with the lock not being released so you won't be able to perform any more changes (not even plan a new change!)

    $ terraform plan
    Acquiring state lock. This may take a few moments...
    
    Error: Error locking state: Error acquiring the state lock: ConditionalCheckFailedException: The conditional request failed
    Lock Info:
      ID:        **6dec3c3f-dea3-4232-60f5-5fe0647a41f6**
      Path:      demo/terraform.tfstate
      Operation: OperationTypePlan
      Who:       jordi.prats@pet2cattle.com
      Version:   0.12.29
      Created:   2020-12-21 21:26:08.295375151 +0000 UTC
      Info:      
    
    
    Terraform acquires a state lock to protect the state from being written
    by multiple users at the same time. Please resolve the issue above and try
    again. For most commands, you can disable locking with the "-lock=false"
    flag, but this is not recommended.
    

    21/12/2020

    Read more...

More recent...

Older content...