Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix terraform AWS provider patch for terraform tests #6853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions etc/tf-patch/0001-endpoints.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
diff --git a/internal/conns/config.go b/internal/conns/config.go
index 7bfd3100fd..3258372938 100644
index 2737b0b2f8..95259e3126 100644
--- a/internal/conns/config.go
+++ b/internal/conns/config.go
@@ -78,8 +78,22 @@ type Config struct {
@@ -84,8 +84,22 @@ type Config struct {
UseFIPSEndpoint bool
}

+func GetLocalEndpoints() map[string]string {
+ const localEndpoint = "http://localhost:4566"
+ var localEndpoints = map[string]string{}
Expand All @@ -19,22 +19,22 @@ index 7bfd3100fd..3258372938 100644
+ return localEndpoints
+}
+
// Client configures and returns a fully initialized AWSClient
func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) {
// ConfigureProvider configures the provided provider Meta (instance data).
func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWSClient, diag.Diagnostics) {
+ 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 c24f096fb7..44887ea1fc 100644
index a0af64476f..dcb74c0e5a 100644
--- a/internal/provider/provider.go
+++ b/internal/provider/provider.go
@@ -2113,7 +2113,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer
@@ -2184,7 +2184,7 @@ func configure(ctx context.Context, provider *schema.Provider, d *schema.Resourc
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(),
HTTPProxy: d.Get("http_proxy").(string),
IgnoreTagsConfig: expandProviderIgnoreTags(d.Get("ignore_tags").([]interface{})),
Insecure: d.Get("insecure").(bool),
MaxRetries: 25, // Set default here, not in schema (muxing with v6 provider).