Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be changing, but it looks like it's just the tests so maybe it's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the issue is that somehow the diff moved the functions around. Not sure why the diff generation is not stable. I didn't modify any of these files as part of my change.

Original file line number Diff line number Diff line change
Expand Up @@ -392,41 +392,14 @@ index 884f83084b..0856302c30 100644
recovery_window_in_days = 0
}

@@ -952,18 +954,18 @@ resource "aws_secretsmanager_secret_version" "test2" {
@@ -952,46 +954,18 @@ resource "aws_secretsmanager_secret_version" "test2" {
secret_id = aws_secretsmanager_secret.test2.id
secret_string = "{\"username\":\"db_user\",\"password\":\"db_user_password\"}"
}
-`, rName, nName))
+`, rName, nName)
}

-func testAccProxyConfig_tags1(rName, tagKey1, tagValue1 string) string {
- return acctest.ConfigCompose(testAccProxyConfig_base(rName), fmt.Sprintf(`
+func testAccProxyConfig_tags(rName, key, value string) string {
+ return acctest.ConfigCompose(testAccProxyBaseConfig(rName), fmt.Sprintf(`
resource "aws_db_proxy" "test" {
depends_on = [
aws_secretsmanager_secret_version.test,
aws_iam_role_policy.test
]

- name = %[1]q
+ name = "%[1]s"
engine_family = "MYSQL"
role_arn = aws_iam_role.test.arn
vpc_security_group_ids = [aws_security_group.test.id]
@@ -977,37 +979,8 @@ resource "aws_db_proxy" "test" {
}

tags = {
- %[2]q = %[3]q
+ %[2]s = "%[3]s"
}
}
-`, rName, tagKey1, tagValue1))
-}
-
-func testAccProxyConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string {
-func testAccProxyConfig_tags1(rName, tagKey1, tagValue1 string) string {
- return acctest.ConfigCompose(testAccProxyConfig_base(rName), fmt.Sprintf(`
-resource "aws_db_proxy" "test" {
- depends_on = [
Expand All @@ -449,9 +422,36 @@ index 884f83084b..0856302c30 100644
-
- tags = {
- %[2]q = %[3]q
- %[4]q = %[5]q
- }
-}
-`, rName, tagKey1, tagValue1))
+`, rName, nName)
}

-func testAccProxyConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string {
- return acctest.ConfigCompose(testAccProxyConfig_base(rName), fmt.Sprintf(`
+func testAccProxyConfig_tags(rName, key, value string) string {
+ return acctest.ConfigCompose(testAccProxyBaseConfig(rName), fmt.Sprintf(`
resource "aws_db_proxy" "test" {
depends_on = [
aws_secretsmanager_secret_version.test,
aws_iam_role_policy.test
]

- name = %[1]q
+ name = "%[1]s"
engine_family = "MYSQL"
role_arn = aws_iam_role.test.arn
vpc_security_group_ids = [aws_security_group.test.id]
@@ -1005,9 +979,8 @@ resource "aws_db_proxy" "test" {
}

tags = {
- %[2]q = %[3]q
- %[4]q = %[5]q
+ %[2]s = "%[3]s"
}
}
-`, rName, tagKey1, tagValue1, tagKey2, tagValue2))
+`, rName, key, value))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alberto Pose <[email protected]>
Date: Thu, 23 Oct 2025 11:11:23 +0100
Subject: [PATCH] Adding APN 1.1 marketplace identifier to User Agent request
string.


diff --git a/internal/conns/config.go b/internal/conns/config.go
index c1d3e94c55..74be293b99 100644
--- a/internal/conns/config.go
+++ b/internal/conns/config.go
@@ -80,6 +80,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS
Products: []awsbase.UserAgentProduct{
{Name: "Pulumi", Version: "1.0"},
{Name: "Pulumi-Aws", Version: c.TerraformVersion, Comment: "+https://pulumi.com"},
+ {Name: "APN", Version: "1.1", Comment: "c7qiae2l6usvzoynupds6v7hf"},
},
},
AssumeRole: c.AssumeRole,
91 changes: 91 additions & 0 deletions provider/provider_endpoint_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package provider

import (
"context"
"net/http"
"net/http/httptest"
"testing"

structpb "github.com/golang/protobuf/ptypes/struct"
pfbridge "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge"
pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func testProviderServer() (pulumirpc.ResourceProviderServer, error) {
info := *Provider()
ctx := context.Background()
p, err := pfbridge.MakeMuxedServer(ctx, info.Name, info,
/*
* We leave the schema blank. This will result in incorrect calls to
* GetSchema, but otherwise does not effect the provider. It reduces the
* time to test start by minutes.
*/
[]byte("{}"),
)(nil)
return p, err
}

func TestProviderEndpoints(t *testing.T) {
stsGetCallerIdentityResponse := `
<GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
<GetCallerIdentityResult>
<Arn>arn:aws:iam::123456789012:user/Alice</Arn>
<UserId>AIDACKCEVSQ6C2EXAMPLE</UserId>
<Account>123456789012</Account>
</GetCallerIdentityResult>
<ResponseMetadata>
<RequestId>01234567-89ab-cdef-0123-456789abcdef</RequestId>
</ResponseMetadata>
</GetCallerIdentityResponse>`

t.Run("requests to AWS use the APN/1.1 marketplace identifier in the User-Agent request header", func(t *testing.T) {
requestCount := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Contains(t, r.Header.Get("User-Agent"), "APN/1.1 (c7qiae2l6usvzoynupds6v7hf)")
switch requestCount {
case 0:
w.Write([]byte(stsGetCallerIdentityResponse))
case 1:
w.Write([]byte("{}"))
default:
t.Fatalf("Unexpected request count: %d", requestCount)
}
requestCount++
}))
t.Cleanup(server.Close)

// Using environment variables since configuring passing variables to
// provider.Configure is too late on the lifecycle of the provider. These
// values are fetched when the provider is initialized.
t.Setenv("AWS_ENDPOINT_URL", server.URL)
t.Setenv("AWS_SKIP_METADATA_API_CHECK", "true")
t.Setenv("AWS_SKIP_CREDENTIALS_VALIDATION", "true")
t.Setenv("AWS_ACCESS_KEY_ID", "test")
t.Setenv("AWS_SECRET_ACCESS_KEY", "test")
t.Setenv("AWS_SESSION_TOKEN", "test")
t.Setenv("AWS_REGION", "us-west-2")
t.Setenv("AWS_PROFILE", "")

provider, err := testProviderServer()
require.NoError(t, err)
ctx := context.Background()
_, err = provider.Configure(ctx, &pulumirpc.ConfigureRequest{})
require.NoError(t, err)
_, err = provider.Invoke(ctx, &pulumirpc.InvokeRequest{
Tok: "aws:s3/getObjects:getObjects",
Args: &structpb.Struct{
Fields: map[string]*structpb.Value{
"bucket": {
Kind: &structpb.Value_StringValue{
StringValue: "test-bucket",
},
},
},
},
})
require.NoError(t, err)
assert.Equal(t, 2, requestCount)
})
}