This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-terraform.git


The following commit(s) were added to refs/heads/main by this push:
     new 528a843  Make the provider buildable (#11)
528a843 is described below

commit 528a84385ff93d3a98fd964a53c8de1d00ac328e
Author: Alex Stephen <[email protected]>
AuthorDate: Fri Jan 30 13:29:23 2026 -0800

    Make the provider buildable (#11)
    
    * Make the provider buildable
    
    * Add license
---
 .github/workflows/go-ci.yml |  5 ++++
 main.go => Makefile         | 31 +++++++++-----------
 build.sh                    | 69 +++++++++++++++++++++++++++++++++++++++++++++
 dev/docker-compose.yml      | 52 ++++++++++++++++++++++++++++++++++
 main.go                     |  6 ++--
 5 files changed, 142 insertions(+), 21 deletions(-)

diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml
index 0a4b56e..da4ca19 100644
--- a/.github/workflows/go-ci.yml
+++ b/.github/workflows/go-ci.yml
@@ -60,3 +60,8 @@ jobs:
       run: staticcheck ./...
     - name: Run tests
       run: go test -v ./...
+    - name: Run integration tests
+      run: make test-integration
+    - name: Show debug logs
+      if: ${{ failure() }}
+      run: docker compose -f dev/docker-compose.yml logs
diff --git a/main.go b/Makefile
similarity index 51%
copy from main.go
copy to Makefile
index 761bab3..79007dd 100644
--- a/main.go
+++ b/Makefile
@@ -13,25 +13,20 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package main
+.PHONY: test-integration test-integration-setup test-integration-exec 
test-integration-cleanup
 
-import (
-       "context"
-       "log"
+test-integration: test-integration-setup test-integration-exec 
test-integration-cleanup ## Run integration tests
 
-       "github.com/apache/iceberg-terraform/internal/provider"
-       "github.com/hashicorp/terraform-plugin-framework/providerserver"
-)
+test-integration-setup: ## Start Docker services for integration tests
+       docker compose -f dev/docker-compose.yml kill
+       docker compose -f dev/docker-compose.yml rm -f
+       docker compose -f dev/docker-compose.yml up -d --wait
 
-const ADDRESS = "iceberg.apache.org/terraform"
+test-integration-exec: ## Run integration tests
+       TF_ACC=1 ICEBERG_CATALOG_URI=http://localhost:8181 go test ./... -v
 
-func main() {
-       err := providerserver.Serve(context.Background(), provider.New, 
providerserver.ServeOpts{
-               // TODO: This needs to change on release with the published 
name.
-               Address: ADDRESS,
-       })
-
-       if err != nil {
-               log.Fatal(err)
-       }
-}
+test-integration-cleanup: ## Clean up integration test environment
+       @if [ "${KEEP_COMPOSE}" != "1" ]; then \
+               echo "Cleaning up Docker containers..."; \
+               docker compose -f dev/docker-compose.yml down; \
+       fi
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..ea7b05f
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+#    http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# --- Configuration ---
+PROVIDER_NAMESPACE="apache"
+PROVIDER_TYPE="iceberg"
+VERSION="1.0.0" 
+BINARY_BASE_NAME="terraform-provider-iceberg"
+BINARY_NAME="${BINARY_BASE_NAME}_v${VERSION}"
+
+# 1. Detect OS and Architecture
+OS=$(uname -s | tr '[:upper:]' '[:lower:]')
+ARCH=$(uname -m)
+[[ "$ARCH" == "x86_64" ]] && ARCH="amd64"
+[[ "$ARCH" == "arm64" || "$ARCH" == "aarch64" ]] && ARCH="arm64"
+OS_ARCH="${OS}_${ARCH}"
+
+# 2. Define Paths
+PLUGIN_BASE_DIR="$(pwd)/terraform-plugins"
+SPECIFIC_PATH="${PLUGIN_BASE_DIR}/registry.terraform.io/${PROVIDER_NAMESPACE}/${PROVIDER_TYPE}/${VERSION}/${OS_ARCH}"
+
+# 3. Build the Binary
+echo "Building provider for $OS_ARCH..."
+# We use -o to specify the exact filename Terraform expects
+go build -o "$BINARY_NAME"
+
+if [ $? -ne 0 ]; then
+    echo "Error: Go build failed. Ensure you are in the provider source root 
and Go is installed."
+    exit 1
+fi
+
+# 4. Create Directory Structure
+echo "Creating directory: $SPECIFIC_PATH"
+mkdir -p "$SPECIFIC_PATH"
+
+# 5. Move binary to the mirror
+mv "$BINARY_NAME" "$SPECIFIC_PATH/"
+chmod +x "$SPECIFIC_PATH/$BINARY_NAME"
+echo "Success: Binary built and moved to local mirror."
+
+# 6. Output .terraformrc snippet
+echo "-----------------------------------------------------------"
+echo "Add the following to your ~/.terraformrc file:"
+echo "-----------------------------------------------------------"
+cat <<EOF
+provider_installation {
+  filesystem_mirror {
+    path    = "$PLUGIN_BASE_DIR"
+    include = ["registry.terraform.io/${PROVIDER_NAMESPACE}/${PROVIDER_TYPE}"]
+  }
+  direct {
+    exclude = ["registry.terraform.io/${PROVIDER_NAMESPACE}/${PROVIDER_TYPE}"]
+  }
+}
+EOF
diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml
new file mode 100644
index 0000000..90e8d7f
--- /dev/null
+++ b/dev/docker-compose.yml
@@ -0,0 +1,52 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+version: "3"
+services:
+  rest:
+    image: tabulario/iceberg-rest:0.10.0
+    ports:
+      - 8181:8181
+    environment:
+      - CATALOG_WAREHOUSE=s3://warehouse/
+      - CATALOG_IO__IMPL=org.apache.iceberg.aws.s3.S3FileIO
+      - CATALOG_S3__ENDPOINT=http://minio:9000
+      - CATALOG_S3__ACCESS__KEY__ID=admin
+      - CATALOG_S3__SECRET__ACCESS__KEY=password
+      - CATALOG_S3__PATH__STYLE__ACCESS=true
+      - AWS_REGION=us-east-1
+    depends_on:
+      - minio
+
+  minio:
+    image: minio/minio:latest
+    ports:
+      - 9000:9000
+      - 9001:9001
+    environment:
+      - MINIO_ROOT_USER=admin
+      - MINIO_ROOT_PASSWORD=password
+    command: server /data --console-address ":9001"
+
+  mc:
+    image: minio/mc
+    depends_on:
+      - minio
+    entrypoint: >
+      /bin/sh -c "
+      until mc alias set minio http://minio:9000 admin password; do echo 
'...waiting...' && sleep 1; done;
+      mc mb minio/warehouse;
+      exit 0;
+      "
diff --git a/main.go b/main.go
index 761bab3..746e4c7 100644
--- a/main.go
+++ b/main.go
@@ -19,14 +19,14 @@ import (
        "context"
        "log"
 
-       "github.com/apache/iceberg-terraform/internal/provider"
+       "github.com/apache/terraform-provider-iceberg/internal/provider"
        "github.com/hashicorp/terraform-plugin-framework/providerserver"
 )
 
-const ADDRESS = "iceberg.apache.org/terraform"
+const ADDRESS = "apache.org/iceberg/terraform-provider-iceberg"
 
 func main() {
-       err := providerserver.Serve(context.Background(), provider.New, 
providerserver.ServeOpts{
+       err := providerserver.Serve(context.Background(), provider.New(), 
providerserver.ServeOpts{
                // TODO: This needs to change on release with the published 
name.
                Address: ADDRESS,
        })

Reply via email to