My Shitty Code

Embracing the Messiness in Search of Epic Solutions

Category: Programming Language

  • Terragrunt: “plan-all” while Passing Outputs between Modules

    PROBLEM Terragrunt has a feature that allows one module to pass outputs to another module. For example, if “project-prod” module wants to consume “subfolders” output from “folder” module, it can be done like this in “project-prod” module’s terragrunt.hcl:- The challenge is when running commands such as plan-all, it will fail with the following error:- SOLUTION […]

  • GCP + Terraform: “google: could not find default credentials” Error

    PROBLEM When running any Terraform commands (init, plan, etc) from a different server, the following error is thrown:- SOLUTION One recommended way is to set up a service account by following the instruction from the above link. Another way, for developement purpose, is to install Google Cloud SDK and run the following gcloud command, which […]

  • Terraform: “Error acquiring the state lock” Error

    PROBLEM When running terraform plan, the following error is thrown:- SOLUTION One way is to disable locking by passing -lock=false flag. However, if you are sure the lock isn’t properly released, to perform a force unlock, run this command: In this case…

  • Webpack: Managing Tree Shaking

    PROBLEM Sometimes, Webpack’s tree-shaking may accidentally eliminate imported code from import statements. For example, we may have a root JS file that imports a CSS file:- … and for some reason, the CSS file will never appear in the final bundle even if the Webpack config contains proper rules to handle CSS files. SOLUTION To […]

  • Feign + Eureka: UnknownHostException when Attempting to Invoke a Service

    PROBLEM When attempting use Feign to invoke a service through Eureka, the following exception occurs:- SOLUTION Go to the donkey-kong-service app and add the following line to the application.properties:- Now, when Feign tries to invoke the service, the IP address will be used instead of the OS’ reported hostname.

  • Spring Boot: Connecting to IBM MQ over JMS using non-IBM JRE

    There are several ways to connect to IBM MQ:- This article shows you how to connect with Spring’s JmsTemplate. CONNECTIVITY INFO Typically, the MQ admin will provide the following connectivity info that allows you to connect to MQ:- DEPENDENCY Add the following dependency:- SPRING CONFIGURATION While the connectivity info can be hardcoded in Spring Boot’s […]