| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  | From 83f8df495c5fc187d925a7dd61f93d1fdc4f405b Mon Sep 17 00:00:00 2001 | 
					
						
							| 
									
										
										
										
											2023-02-25 19:24:03 -01:00
										 |  |  | From: Bert Blommers <info@bertblommers.nl> | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  | Date: Sun, 13 Aug 2023 21:16:30 +0000 | 
					
						
							|  |  |  | Subject: [PATCH] Patch endpoints to localhost:4566 | 
					
						
							| 
									
										
										
										
											2023-02-25 19:24:03 -01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ---
 | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  |  internal/conns/config.go      | 14 ++++++++++++++ | 
					
						
							| 
									
										
										
										
											2023-02-25 19:24:03 -01:00
										 |  |  |  internal/provider/provider.go |  4 ++-- | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  |  2 files changed, 16 insertions(+), 2 deletions(-) | 
					
						
							| 
									
										
										
										
											2023-02-25 19:24:03 -01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-26 17:23:26 +00:00
										 |  |  | diff --git a/internal/conns/config.go b/internal/conns/config.go
 | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  | index 72c9cabde0..1f2e0d00e9 100644
 | 
					
						
							| 
									
										
										
										
											2022-06-26 17:23:26 +00:00
										 |  |  | --- a/internal/conns/config.go
 | 
					
						
							|  |  |  | +++ b/internal/conns/config.go
 | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  | @@ -55,10 +55,24 @@ type Config struct {
 | 
					
						
							| 
									
										
										
										
											2022-06-26 17:23:26 +00:00
										 |  |  |  	UseFIPSEndpoint                bool | 
					
						
							| 
									
										
										
										
											2022-04-16 10:02:57 +00:00
										 |  |  |  } | 
					
						
							| 
									
										
										
										
											2022-06-26 17:23:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-16 10:02:57 +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() {
 | 
					
						
							| 
									
										
										
										
											2022-04-16 10:02:57 +00:00
										 |  |  | +		localEndpoints[name] = localEndpoint
 | 
					
						
							|  |  |  | +	}
 | 
					
						
							|  |  |  | +	return localEndpoints
 | 
					
						
							|  |  |  | +}
 | 
					
						
							|  |  |  | +
 | 
					
						
							| 
									
										
										
										
											2022-10-04 11:26:48 +00:00
										 |  |  |  // ConfigureProvider configures the provided provider Meta (instance data). | 
					
						
							|  |  |  |  func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWSClient, diag.Diagnostics) { | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  |  	var diags diag.Diagnostics | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | +    // XXX: added by bblommers
 | 
					
						
							| 
									
										
										
										
											2022-06-26 17:23:26 +00:00
										 |  |  | +	// insert custom endpoints
 | 
					
						
							|  |  |  | +	c.Endpoints = GetLocalEndpoints()
 | 
					
						
							|  |  |  | +
 | 
					
						
							|  |  |  |  	awsbaseConfig := awsbase.Config{ | 
					
						
							|  |  |  |  		AccessKey:                     c.AccessKey, | 
					
						
							|  |  |  |  		APNInfo:                       StdUserAgentProducts(c.TerraformVersion), | 
					
						
							| 
									
										
										
										
											2022-04-16 10:02:57 +00:00
										 |  |  | diff --git a/internal/provider/provider.go b/internal/provider/provider.go
 | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  | index 88c6ea9538..cfe78c5549 100644
 | 
					
						
							| 
									
										
										
										
											2022-04-16 10:02:57 +00:00
										 |  |  | --- a/internal/provider/provider.go
 | 
					
						
							|  |  |  | +++ b/internal/provider/provider.go
 | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  | @@ -452,13 +452,13 @@ func configure(ctx context.Context, provider *schema.Provider, d *schema.Resourc
 | 
					
						
							| 
									
										
										
										
											2022-04-16 10:02:57 +00:00
										 |  |  |  		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), | 
					
						
							|  |  |  |  		Insecure:                       d.Get("insecure").(bool), | 
					
						
							| 
									
										
										
										
											2022-10-04 11:26:48 +00:00
										 |  |  |  		MaxRetries:                     25, // Set default here, not in schema (muxing with v6 provider). | 
					
						
							| 
									
										
										
										
											2022-06-29 20:12:56 +00:00
										 |  |  |  		Profile:                        d.Get("profile").(string), | 
					
						
							|  |  |  |  		Region:                         d.Get("region").(string), | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  | -		S3UsePathStyle:                 d.Get("s3_use_path_style").(bool),
 | 
					
						
							| 
									
										
										
										
											2022-06-29 20:12:56 +00:00
										 |  |  | +		S3UsePathStyle:                 true,
 | 
					
						
							|  |  |  |  		SecretKey:                      d.Get("secret_key").(string), | 
					
						
							|  |  |  |  		SkipCredsValidation:            d.Get("skip_credentials_validation").(bool), | 
					
						
							| 
									
										
										
										
											2023-08-21 20:33:16 +00:00
										 |  |  |  		SkipRegionValidation:           d.Get("skip_region_validation").(bool), | 
					
						
							| 
									
										
										
										
											2023-02-25 19:24:03 -01:00
										 |  |  | --
 | 
					
						
							|  |  |  | 2.25.1 |