moto/tests/terraformtests/etc/0001-Patch-Hardcode-endpoints-to-local-server.patch

63 lines
2.7 KiB
Diff
Raw Normal View History

2022-06-29 20:12:56 +00:00
From 91f2d9c33f241cb9dfb3700eaa739a46a06a29bc Mon Sep 17 00:00:00 2001
From: Bert Blommers <info@bertblommers.nl>
2022-06-29 20:12:56 +00:00
Date: Wed, 29 Jun 2022 16:24:04 +0000
2022-06-26 17:23:26 +00:00
Subject: [PATCH] Patch: Hardcode endpoints
---
2022-06-26 17:23:26 +00:00
internal/conns/config.go | 15 +++++++++++++++
2022-06-29 20:12:56 +00:00
internal/provider/provider.go | 4 ++--
2 files changed, 17 insertions(+), 2 deletions(-)
2022-06-26 17:23:26 +00:00
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
}
2022-06-26 17:23:26 +00:00
+// XXX: added by bblommers
+func GetLocalEndpoints() map[string]string {
+ const localEndpoint = "http://localhost:4566"
+ var localEndpoints = map[string]string{}
2022-06-26 17:23:26 +00:00
+ 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) {
+
2022-06-26 17:23:26 +00:00
+ // 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
2022-06-29 20:12:56 +00:00
index 7e6200d9ac..98d8c4fccc 100644
--- a/internal/provider/provider.go
+++ b/internal/provider/provider.go
2022-06-29 20:12:56 +00:00
@@ -2082,14 +2082,14 @@ 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),
2022-06-29 20:12:56 +00:00
MaxRetries: d.Get("max_retries").(int),
Profile: d.Get("profile").(string),
Region: d.Get("region").(string),
- S3UsePathStyle: d.Get("s3_use_path_style").(bool) || d.Get("s3_force_path_style").(bool),
+ S3UsePathStyle: true,
SecretKey: d.Get("secret_key").(string),
SkipCredsValidation: d.Get("skip_credentials_validation").(bool),
SkipGetEC2Platforms: d.Get("skip_get_ec2_platforms").(bool),
--
2.25.1