File terraform-provider-powerdns.spec of Package terraform-provider-powerdns

#
# spec file for package terraform-provider-powerdns
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2025 Georg Pfuetzenreuter
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

#global provider_prefix github.com/tacerus/terraform-provider-powerdns
%global registry        opensuse
%global namespace       tacerus
%global providername    powerdns

%ifarch aarch64
%define terraformarch   amd64
%endif
%ifarch ppc64
%define terraformarch   ppc64
%endif
%ifarch ppc64le
%define terraformarch   ppc64le
%endif
%ifarch s390x
%define terraformarch   s390x
%endif
%ifarch %{ix86}
%define terraformarch   i386
%endif
%ifarch x86_64
%define terraformarch   amd64
%endif

Name:           terraform-provider-powerdns
Version:        1.1.2
Release:        0
Summary:        Terraform provider for PowerDNS
License:        MPL-2.0
URL:            https://github.com/tacerus/terraform-provider-powerdns
Source:         %{name}-%{version}.tar.zst
BuildRequires:  go >= 1.12
BuildRequires:  golang-packaging
BuildRequires:  zstd

%description
Terraform provider supporting the management of zones and records in PowerDNS.

%prep
%autosetup -p1

%build
go build -mod=vendor -p 4 -x -buildmode=pie -ldflags='-w'

%install
install -Dvm0755 %{name} %{buildroot}%{_bindir}/%{name}
ln -sv %{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}_v%{version}
install -dvm0755 %{buildroot}%{_datadir}/terraform/providers/%{registry}/%{namespace}/%{providername}/%{version}/linux_%{terraformarch}
ln -s %{_bindir}/%{name} %{buildroot}%{_datadir}/terraform/providers/%{registry}/%{namespace}/%{providername}/%{version}/linux_%{terraformarch}/%{name}_v%{version}

# I don't know why my provider tries to _additionally_ search for hashicorp/powerdns after already having succeeded to install tacerus/powerdns
install -dvm0755 %{buildroot}%{_datadir}/terraform/providers/registry.opentofu.org/hashicorp/%{providername}/%{version}/linux_%{terraformarch}
ln %{buildroot}%{_datadir}/terraform/providers/%{registry}/%{namespace}/%{providername}/%{version}/linux_%{terraformarch}/%{name}_v%{version} %{buildroot}%{_datadir}/terraform/providers/registry.opentofu.org/hashicorp/%{providername}/%{version}/linux_%{terraformarch}/

install -dvm0755 %{buildroot}%{_datadir}/terraform/modules/%{providername}
install -m0644 {main,variables}.tf %{buildroot}%{_datadir}/terraform/modules/%{providername}

%check
# tries to access proxy.golang.org
#go test -v github.com/terraform-providers/terraform-provider-powerdns/powerdns

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{_bindir}/%{name}_v%{version}
%{_datadir}/terraform

%changelog

openSUSE Build Service is sponsored by