• Configure an AWS Load Balancer to target an Autoscaling Group using terraform

    3 min read

    Terraform AWS load balancer target auto scaling group

    It's quite convenient to be able to configure a AWS Load Balancer to target an Auto Scaling Group so we don't have to handle how instances are getting in and out of this load balancer. This can be done easily using terraform as follows

    04/05/2022

    Read more...
  • Enable access logs for an AWS ALB using terraform

    2 min read

    To be able to collect access logs it might be just more convenient to be able to enable them at the load balancer level rather than having to aggregate logs from all the backend services. If we are using an AWS ALB we can configure it to push it's logs to an S3 bucket

    29/04/2022

    Read more...
  • How to update terraform modules

    5 min read

    terraform init upgrade git

    When we change the location of any terraform module we need to run terraform init again to be able to pick up the right version:

    $ terraform plan
    Acquiring state lock. This may take a few moments...
    Releasing state lock. This may take a few moments...
    ╷
    │ Error: Module source has changed
    │    on main.tf line 17, in module "terraform-module":
    │   17:   source = "git::ssh://git@github.com/pet2cattle/terraform-module.git?ref=1.0.2"  The source address was changed since this module was installed. Run "terraform init" to install all modules required by this configuration.
    ╵
    

    26/04/2022

    Read more...
  • How to test terraform's HCL code

    2 min read

    terraform console HCL

    To be able to learn about new terraform functions we can use terraform output to learn how a variable is modified. But this can take a while if we have a lot of resources to compute.

    Instead, if we know the values we want to use beforehand it might be easier and quicker to use terraform console

    22/04/2022

    Read more...
  • terraform: How to calculate subnets using the cidrsubnet function

    3 min read

    If we are using terraform for creating subnets on AWS we are going to need to split the VPC's network range into several pieces, one for each AZ. We can let terraform handle all the details by using the cidrsubnet() function

    20/04/2022

    Read more...

More recent...

Older content...