{"id":658,"date":"2023-06-30T14:02:15","date_gmt":"2023-06-30T13:02:15","guid":{"rendered":"http:\/\/darkandscary.co.uk\/?p=658"},"modified":"2023-06-30T14:02:57","modified_gmt":"2023-06-30T13:02:57","slug":"dipping-a-toe-into-terraform","status":"publish","type":"post","link":"https:\/\/darkandscary.co.uk\/?p=658","title":{"rendered":"Dipping a toe into Terraform"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I have been wanting to experiment with Terraform as a way to deploy virtual machines on KVM. The question is, can it be done on OpenSuse?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The quick answer &#8211; yes! The longer answer &#8211; yes, but&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, after a fresh install of Leap 15.5 I installed and ran terraform with these results&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># zypper info terraform\nLoading repository data...\n  \nReading installed packages...\n\nInformation for package terraform:\n----------------------------------\nRepository     : SUSE:SLE-15:Update\nName           : terraform\nVersion        : 0.13.4-6.3.1\nArch           : x86_64\nVendor         : SUSE LLC &lt;https:\/\/www.suse.com\/&gt;\nInstalled Size : 89.7 MiB\nInstalled      : Yes\nStatus         : up-to-date\nSource package : terraform-0.13.4-6.3.1.src\nUpstream URL   : https:\/\/www.terraform.io\/\nSummary        : Tool for building infrastructure safely and efficiently\nDescription    : \n    Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.\n\nlocalhost:~ # terraform -v\nTerraform v0.13.4\n\nYour version of Terraform is out of date! The latest version is 1.5.2. <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That doesn&#8217;t look encouraging&#8230; So, tear it all out and let&#8217;s see if I can install from source.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>blackdragon:~ # git clone https:\/\/github.com\/hashicorp\/terraform.git\nIf 'git' is not a typo you can use command-not-found to lookup the package that contains it, like this:\n    cnf git<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So, OpenSuse out of the box does not have git. Not a problem, as the system tells us what to do&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>blackdragon:~ # cnf git\n                     \nThe program 'git' can be found in following packages:\n  * git-core &#91; path: \/usr\/bin\/git, repository: zypp (openSUSE-Leap-15.5-1) ]\n  * git-core &#91; path: \/usr\/bin\/git, repository: zypp (repo-oss) ]\n  * git-core &#91; path: \/usr\/bin\/git, repository: zypp (https-download.opensuse.org-e37130c1) ]\n\nTry installing with:\n    zypper install git-core\n\nblackdragon:~ # zypper install git-core\nLoading repository data...\n\nReading installed packages...\nResolving package dependencies...\n\nThe following 4 NEW packages are going to be installed:\n  git-core git-gui gitk libsha1detectcoll1\n\n4 new packages to install.\nOverall download size: 5.4 MiB. Already cached: 0 B. After the operation, additional 28.9 MiB will be used.\nContinue? &#91;y\/n\/v\/...? shows all options] (y): y\nRetrieving: libsha1detectcoll1-1.0.3-2.18.x86_64 (SUSE:SLE-15:Update)                                                                                                    (1\/4),  23.2 KiB    \nRetrieving: libsha1detectcoll1-1.0.3-2.18.x86_64.rpm ..................................................................................................................................&#91;done]\nRetrieving: git-core-2.35.3-150300.10.27.1.x86_64 (SUSE:SLE-15:Update)                                                                                                   (2\/4),   4.9 MiB    \nRetrieving: git-core-2.35.3-150300.10.27.1.x86_64.rpm .....................................................................................................................&#91;done (8.9 MiB\/s)]\nRetrieving: gitk-2.35.3-150300.10.27.1.x86_64 (SUSE:SLE-15:Update)                                                                                                       (3\/4), 232.3 KiB    \nRetrieving: gitk-2.35.3-150300.10.27.1.x86_64.rpm .........................................................................................................................&#91;done (1.1 MiB\/s)]\nRetrieving: git-gui-2.35.3-150300.10.27.1.x86_64 (SUSE:SLE-15:Update)                                                                                                    (4\/4), 298.6 KiB    \nRetrieving: git-gui-2.35.3-150300.10.27.1.x86_64.rpm ..................................................................................................................................&#91;done]\n\nChecking for file conflicts: ..........................................................................................................................................................&#91;done]\n(1\/4) Installing: libsha1detectcoll1-1.0.3-2.18.x86_64 ................................................................................................................................&#91;done]\n(2\/4) Installing: git-core-2.35.3-150300.10.27.1.x86_64 ...............................................................................................................................&#91;done]\n(3\/4) Installing: gitk-2.35.3-150300.10.27.1.x86_64 ...................................................................................................................................&#91;done]\n(4\/4) Installing: git-gui-2.35.3-150300.10.27.1.x86_64 ................................................................................................................................&#91;done]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Done! Now I can fetch the source code and compile it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>blackdragon:~ # git clone https:\/\/github.com\/hashicorp\/terraform.git\nCloning into 'terraform'...\nremote: Enumerating objects: 277778, done.\nremote: Counting objects: 100% (891\/891), done.\nremote: Compressing objects: 100% (480\/480), done.\nremote: Total 277778 (delta 475), reused 717 (delta 394), pack-reused 276887\nReceiving objects: 100% (277778\/277778), 292.23 MiB | 20.54 MiB\/s, done.\nResolving deltas: 100% (172709\/172709), done.\n\nblackdragon:~ # cd terraform\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, at this point I am meant to be able to compile the code using go, but it is not installed. However, the output from cnf gives lots of options, none of which appear to be the right choice. A bit of searching on the internet told me to install both the &#8216;go&#8217; and &#8216;go-doc&#8217; packages. This was done and I was able to run the &#8216;go install&#8217; command successfully.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once the compilation is complete, I had to copy the binary from my go\/bin directory to \/usr\/local\/bin after checking that directory is in the system path.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>blackdragon:~\/terraform # echo $PATH\n\/sbin:\/usr\/sbin:\/usr\/local\/sbin:\/root\/bin:\/usr\/local\/bin:\/usr\/bin:\/bin\n\n...\n\nblackdragon:~ # cp go\/bin\/terraform \/usr\/local\/bin\/\nblackdragon:~ # terraform -v\nTerraform v1.6.0-dev\non linux_amd64<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The latest version, checked out from the git repository and built. Good to go!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been wanting to experiment with Terraform as a way to deploy virtual machines on KVM. The question is, can it be done on OpenSuse? The quick answer &#8211; yes! The longer answer &#8211; yes, but&#8230; So, after a fresh install of Leap 15.5 I installed and ran terraform with these results&#8230; That doesn&#8217;t &hellip; <a href=\"https:\/\/darkandscary.co.uk\/?p=658\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Dipping a toe into Terraform<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,26],"tags":[30,28,24],"class_list":["post-658","post","type-post","status-publish","format-standard","hentry","category-linux","category-terraform","tag-git","tag-opensuse","tag-terraform"],"_links":{"self":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=658"}],"version-history":[{"count":5,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/658\/revisions"}],"predecessor-version":[{"id":668,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/658\/revisions\/668"}],"wp:attachment":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}