Replace AWS with local provider to fix end-to-end test on darwin_amd64 (#3224)

Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
This commit is contained in:
Diógenes Fernandes
2025-09-03 09:04:12 -03:00
committed by GitHub
parent c7afcdf9b4
commit 720961605d
5 changed files with 17 additions and 22 deletions

View File

@@ -41,7 +41,7 @@ jobs:
- id: diff
run: |
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin ${{github.event.pull_request.base.ref}}
echo "go=$(git diff --name-only origin/${{github.event.pull_request.base.ref}} | grep -e '\.go' -e '\.github' -e 'go\.mod' -e 'go\.sum' -e '\.gitattributes' | wc -l)" | tee -a "$GITHUB_OUTPUT"
echo "go=$(git diff --name-only origin/${{github.event.pull_request.base.ref}} | grep -e '\.go' -e '\.github' -e 'go\.mod' -e 'go\.sum' -e '\.tf' -e '\.gitattributes' | wc -l)" | tee -a "$GITHUB_OUTPUT"
outputs:
go: ${{ steps.diff.outputs.go }}

View File

@@ -53,12 +53,12 @@ func TestFunction_Simple(t *testing.T) {
}
}
func TestFunction_ProviderDefinedFunctionWithoutConfigure(t *testing.T) {
func TestFunction_ProviderUnconfigured(t *testing.T) {
// This test reaches out to registry.opentofu.org to download the
// test functions provider, so it can only run if network access is allowed
skipIfCannotAccessNetwork(t)
fixturePath := filepath.Join("testdata", "functions_aws")
fixturePath := filepath.Join("testdata", "provider_unconfigured_functions")
tf := e2e.NewBinary(t, tofuBin, fixturePath)
// tofu init
@@ -88,8 +88,8 @@ func TestFunction_ProviderDefinedFunctionWithoutConfigure(t *testing.T) {
}
for _, out := range plan.Changes.Outputs {
if !strings.Contains(string(out.After), "arn:aws:s3:::bucket-prod") {
t.Fatalf("unexpected plan output: %s", string(out.After))
if !strings.Contains(string(out.After), "exists") {
t.Fatalf("unexpected plan output: %s", out.After)
}
}
}

View File

@@ -1,17 +0,0 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "6.9.0"
}
}
}
variable "bucket_name" {
type = string
default = "bucket-prod"
}
output "stuff" {
value = provider::aws::arn_build("aws", "s3", "", "", var.bucket_name)
}

View File

@@ -0,0 +1,12 @@
terraform {
required_providers {
local = {
source = "hashicorp/local"
version = "2.5.3"
}
}
}
output "stuff" {
value = provider::local::direxists("${path.module}/test-folder") ? "exists" : "does not exist"
}