File terragrunt.spec of Package terragrunt

%define realname terragrunt
%define srcext   tar.xz

# Common info
Name:          %{realname}
Version:       0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/Management
URL:           https://terragrunt.gruntwork.io
Summary:       Wrapper for Terraform providing extra tools

# Install-time requirements
Requires:      terraform

# Build-time parameters
BuildRequires: go
BuildRoot:     %{_tmppath}/%{name}-root
Source0:       %{realname}-%{version}.%{srcext}
# cd terragrunt; go mod vendor -v && tar -Jcvf ../vendor.tar.xz vendor && rm -rf vendor
Source1:       vendor.tar.xz

%description
Terragrunt is a thin wrapper for Terraform that provides extra tools for keeping
your Terraform configurations DRY, working with multiple Terraform modules, and
managing remote state.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver} -a1

# Build step (compile/build binaries, documentation, etc)
%build
go build -v -a -mod=vendor -buildmode=pie \
    -gcflags=all=-dwarf=false \
    -ldflags='all=-s -w -X main.VERSION=%{version}' \
    -o bin/terragrunt

# Install built stuff
%install
%{__install} -D -m0755 bin/terragrunt %{buildroot}%{_bindir}/terragrunt

# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

# Files
%files
%defattr(-,root,root)
%license LICENSE.txt
%doc README.md
%{_bindir}/terragrunt

%changelog
openSUSE Build Service is sponsored by