{"id":25825694,"url":"https://github.com/arodriguezdlc/sonatina","last_synced_at":"2026-05-14T04:36:53.646Z","repository":{"id":80531786,"uuid":"175468945","full_name":"arodriguezdlc/sonatina","owner":"arodriguezdlc","description":"Sonatina is an infrastructure as code framework for Terraform, that adds some useful functionality to organize and work with terraform modules and variables in an opinionated way.","archived":false,"fork":false,"pushed_at":"2020-11-29T22:32:50.000Z","size":228,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T01:53:06.765Z","etag":null,"topics":["golang","infrastructure-as-code","sonatina","terraform"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arodriguezdlc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-13T17:32:46.000Z","updated_at":"2022-03-31T09:17:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"a786473c-afcf-4c05-a701-db4defb32fd5","html_url":"https://github.com/arodriguezdlc/sonatina","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arodriguezdlc%2Fsonatina","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arodriguezdlc%2Fsonatina/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arodriguezdlc%2Fsonatina/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arodriguezdlc%2Fsonatina/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arodriguezdlc","download_url":"https://codeload.github.com/arodriguezdlc/sonatina/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241169118,"owners_count":19921563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","infrastructure-as-code","sonatina","terraform"],"created_at":"2025-02-28T14:45:20.616Z","updated_at":"2026-05-14T04:36:53.614Z","avatar_url":"https://github.com/arodriguezdlc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Go](https://github.com/arodriguezdlc/sonatina/workflows/Go/badge.svg)\n[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/golang-standards/project-layout)\n[![Go Report Card](https://goreportcard.com/badge/github.com/arodriguezdlc/sonatina)](https://goreportcard.com/report/github.com/arodriguezdlc/sonatina)\n[![codecov](https://codecov.io/gh/arodriguezdlc/sonatina/branch/master/graph/badge.svg)](https://codecov.io/gh/arodriguezdlc/sonatina)\n\n# Sonatina\n\nSonatina is an infrastructure as code framework based on Terraform, that adds some useful functionality to organize and work with terraform modules and variables in an opinionated way.\n\nThe key features of Sonatina are:\n\n- Based on Hashicorp [Terraform](https://github.com/hashicorp/terraform) (Opensource version).\n\nWarning: private repository are not supported yet, but it will very soon.\n\n##  Concepts\n\n- **Code Tree Definition (CTD)**: file and directory structure of HCL code standarized by\n  Sonatina. It allows combination with other CTDs to enable the addition of plugins.\n- **Variables Tree Definition (VTD)**: variable file structure that allows the identification of\n  them by kind, enabling priorization.\n- **Deployment**: concrete infrastructure to be managed based on the code defined on CTDs.\n- **Modules**: are the [Terraform modules](https://www.terraform.io/docs/modules/index.html) that\n  describes the infraestructure. \n- **Code repository**: GIT repository where the code that defines the infrastructure is stored.\n- **State repository**: GIT repositiory where state and variables of a specified deployment \n  are stored.\n- **Workdir**: temporal folder where Sonatina merges all CTDs that will be applied before passing\n  them to Terraform.\n- **Variables**: terraform variables for the infrastructure. In Sonatina, three kind of\n  variables are defined: config, flavour and static. \n  Config variables can be customized for each deployment. \n  Flavour variables defines the size of the infrastructure components. Static variables are linked\n  to the infrastructure version, and tipically defines the software version to be used.\n- **State**: file that registers the current state of Terraform managed infrastructure. Each\n  component (global or user component) will have its own state file.\n- **User component**: set of resources that are deployed specifically for an user. Multiple of\n  them can be created on each deployment. The resources that doesn't belong to a specified user\n  are part of the global component.\n- **Flavour**: identifies a set of variables that will be used on the deployment. Usually this\n  set are used to define de infrastructure size, allowing the use of flavours with more or less\n  resources.\n- **Plugins**: are CTDs that, combined with the base code CTD, can increment or modify the\n  infrastructure features.\n\n## Getting Started\n\n### Get sonatina\n\nUsing sonatina is easy. First, clone the repository:\n```sh\ngit clone https://github.com/arodriguezdlc/sonatina.git\n```\n\nSonatina uses native Go Modules to manage dependencies, so you only have to execute go build and\nevery dependencies will be fetched for you\n```sh\ncd sonatina\ngo build \n```\n\nAs result, you will have a sonatina binary ready to work. Optionally, you can move it to a\ndirectory in your `$PATH`:\n```\nmv sonatina /usr/local/bin/\n```\n\n### Create your first deployment\n\nSonatina stores deployment state, variables and metadata on a git repository. For this example we\nare going to create a local repository, but you also could create one on\n[github](https://github.com/new) for example.\nLet's assume we hace created this repo:\nhttps://github.com/arodriguezdlc/sonatina-example-local-docker-storage.git\n\nAlso we need a repository with the Terraform code we are going to deploy. \nWe are going to use [an example repository](https://github.com/arodriguezdlc/sonatina-hello-world)\n\nFinally, we can create the deployment with the following sonatina command:\n```sh\nsonatina create deployment example-local-docker -s https://github.com/arodriguezdlc/sonatina-example-local-docker-state.git -c https://github.com/arodriguezdlc/sonatina-example-local-docker.git\n```\n\nYou can see the created deployment with:\n```\nsonatina list deployments\n```\n\nNow we can start working with deployment variables:\n```sh\nsonatina init\nsonatina edit\n```\n\nLet's assign a name for your deployment (the required variable), and deploy it:\n```sh\nsonatina apply\n```\n\nAnd this is all! You have deployed a local docker with a http server listening to the 8080 port. Using variables you can customize other configurations\nlike the port or the sentence that is being shown. \n\nThis has been a global deployment but you can deploy one customized server for a specific client. Let's do that creating an user component:\n```sh\nsonatina create usercomponent my-special-client\nsonatina init -c my-special-client\n```\n\nLet's specify a custom sentence (\"Hello my special client\") for him editing the `sentence` variable. In addition, modify the `port` variable to 8081 to avoid port conflict with global component.\n```sh\nsonatina edit\n```\n\nAnd finally, apply changes:\n```sh\nsonatina apply -c my-special-client\n```\n\n### Cleanup\n\nTo perform the undeploy, you simply have to execute a sonatina destroy command:\n```sh\nsonantina destroy -c my-special-client\nsonatina destroy\n```\n\nAlso you can delete the deployment from Sonatina. Note that this operation won't delete\nthe storage repository, so you recover by cloning it. \n```sh\nsonantina delete deployment example-local-docker\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farodriguezdlc%2Fsonatina","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farodriguezdlc%2Fsonatina","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farodriguezdlc%2Fsonatina/lists"}