moto/tests/terraformtests/etc/0001-Patch-Hardcode-endpoints-to-local-server.patch
2022-06-26 17:23:26 +00:00

55 lines
2.1 KiB
Diff

From 64093955e96cff42a797880b4a6921663af6040d Mon Sep 17 00:00:00 2001
From: Bert Blommers <info@bertblommers.nl>
Date: Sun, 19 Jun 2022 19:32:26 +0000
Subject: [PATCH] Patch: Hardcode endpoints
---
internal/conns/config.go | 15 +++++++++++++++
internal/provider/provider.go | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/internal/conns/config.go b/internal/conns/config.go
index 7bfd3100fd..b59083068a 100644
--- a/internal/conns/config.go
+++ b/internal/conns/config.go
@@ -78,8 +78,23 @@ type Config struct {
UseFIPSEndpoint bool
}
+// XXX: added by bblommers
+func GetLocalEndpoints() map[string]string {
+ const localEndpoint = "http://localhost:4566"
+ var localEndpoints = map[string]string{}
+ for _, name := range names.Aliases() {
+ localEndpoints[name] = localEndpoint
+ }
+ return localEndpoints
+}
+
// Client configures and returns a fully initialized AWSClient
func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) {
+
+ // XXX: added by bblommers
+ // insert custom endpoints
+ c.Endpoints = GetLocalEndpoints()
+
awsbaseConfig := awsbase.Config{
AccessKey: c.AccessKey,
APNInfo: StdUserAgentProducts(c.TerraformVersion),
diff --git a/internal/provider/provider.go b/internal/provider/provider.go
index 7e6200d9ac..7005caccd3 100644
--- a/internal/provider/provider.go
+++ b/internal/provider/provider.go
@@ -2082,7 +2082,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer
CustomCABundle: d.Get("custom_ca_bundle").(string),
EC2MetadataServiceEndpoint: d.Get("ec2_metadata_service_endpoint").(string),
EC2MetadataServiceEndpointMode: d.Get("ec2_metadata_service_endpoint_mode").(string),
- Endpoints: make(map[string]string),
+ Endpoints: conns.GetLocalEndpoints(), // XXX: added by bblommers
HTTPProxy: d.Get("http_proxy").(string),
IgnoreTagsConfig: expandProviderIgnoreTags(d.Get("ignore_tags").([]interface{})),
Insecure: d.Get("insecure").(bool),
--
2.25.1