Skip to content

Commit

Permalink
Deprecate name on aws.rds.Instance (#2686)
Browse files Browse the repository at this point in the history
Fixes #2682

With this change "name" property is deprecated on aws.db.Instance in favor of "dbName". Continuing to use it should sill work as expected but will now generate a warning.

---------

Co-authored-by: Anton Tayanovskyy <[email protected]>
  • Loading branch information
iwahbe and t0yv0 committed Aug 11, 2023
1 parent dbe3da9 commit f158e81
Show file tree
Hide file tree
Showing 46 changed files with 1,910 additions and 421 deletions.
181 changes: 180 additions & 1 deletion examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
package examples

import (
"context"
"io/ioutil"
"net/http"
"os"
"testing"
"time"

pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge"
testutils "github.com/pulumi/pulumi-terraform-bridge/testing/x"
"github.com/pulumi/pulumi/pkg/v3/testing/integration"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/pulumi/pulumi/pkg/v3/testing/integration"
aws "github.com/pulumi/pulumi-aws/provider/v6"
version "github.com/pulumi/pulumi-aws/provider/v6/pkg/version"
)

func createEditDir(dir string) integration.EditDir {
Expand Down Expand Up @@ -72,3 +78,176 @@ func validateAPITest(isValid func(body string)) func(t *testing.T, stack integra
isValid(string(body))
}
}

func init() {
// This is necessary for gRPC testing. It doesn't effect integration tests, since
// they use their own binary.
version.Version = "6.0.0"
}

func replay(t *testing.T, sequence string) {
info := *aws.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)
require.NoError(t, err)
testutils.ReplaySequence(t, p, sequence)
}

// This replicates the diff when running `pulumi preview` on a aws.rds.Instance with
// pulumi-aws v6.0.0 and state from pulumi-aws 5.42.0.
//
// This ensures we don't regress on https://github.com/pulumi/pulumi-aws/issues/2682
func TestMigrateRdsInstance(t *testing.T) {
replay(t, `[
{
"method": "/pulumirpc.ResourceProvider/Diff",
"request": {
"id": "postgresdb8a8a6f1",
"urn": "urn:pulumi:dev::ts::aws:rds/instance:Instance::postgresdb",
"olds": {
"__meta": "{\"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0\":{\"create\":2400000000000,\"delete\":3600000000000,\"update\":4800000000000},\"schema_version\":\"1\"}",
"address": "postgresdb8a8a6f1.chuqccm8uxqx.us-west-2.rds.amazonaws.com",
"allocatedStorage": 30,
"applyImmediately": false,
"arn": "arn:aws:rds:us-west-2:616138583583:db:postgresdb8a8a6f1",
"autoMinorVersionUpgrade": true,
"availabilityZone": "us-west-2d",
"backupRetentionPeriod": 0,
"backupWindow": "06:15-06:45",
"caCertIdentifier": "rds-ca-2019",
"characterSetName": "",
"copyTagsToSnapshot": false,
"customIamInstanceProfile": "",
"customerOwnedIpEnabled": false,
"dbName": "airflow",
"dbSubnetGroupName": "default",
"deleteAutomatedBackups": true,
"deletionProtection": false,
"domain": "",
"domainIamRoleName": "",
"enabledCloudwatchLogsExports": [],
"endpoint": "postgresdb8a8a6f1.chuqccm8uxqx.us-west-2.rds.amazonaws.com:5432",
"engine": "postgres",
"engineVersion": "15.3",
"engineVersionActual": "15.3",
"hostedZoneId": "Z1PVIF0B656C1W",
"iamDatabaseAuthenticationEnabled": false,
"id": "postgresdb8a8a6f1",
"identifier": "postgresdb8a8a6f1",
"identifierPrefix": "",
"instanceClass": "db.t4g.micro",
"iops": 0,
"kmsKeyId": "",
"latestRestorableTime": "",
"licenseModel": "postgresql-license",
"listenerEndpoints": [],
"maintenanceWindow": "sun:07:16-sun:07:46",
"masterUserSecrets": [],
"maxAllocatedStorage": 0,
"monitoringInterval": 0,
"monitoringRoleArn": "",
"multiAz": false,
"name": "airflow",
"ncharCharacterSetName": "",
"networkType": "IPV4",
"optionGroupName": "default:postgres-15",
"parameterGroupName": "default.postgres15",
"password": "tuFp574p9Arw58gu",
"performanceInsightsEnabled": false,
"performanceInsightsKmsKeyId": "",
"performanceInsightsRetentionPeriod": 0,
"port": 5432,
"publiclyAccessible": false,
"replicaMode": "",
"replicas": [],
"replicateSourceDb": "",
"resourceId": "db-DUPUZANEFBXYECMTI2B5RZPTOE",
"securityGroupNames": [],
"skipFinalSnapshot": true,
"status": "available",
"storageEncrypted": false,
"storageThroughput": 0,
"storageType": "gp2",
"tags": {},
"tagsAll": {},
"timezone": "",
"username": "airflow",
"vpcSecurityGroupIds": [
"sg-4d436f12"
]
},
"news": {
"__defaults": [
"applyImmediately",
"autoMinorVersionUpgrade",
"copyTagsToSnapshot",
"deleteAutomatedBackups",
"identifier",
"monitoringInterval",
"performanceInsightsEnabled",
"publiclyAccessible"
],
"allocatedStorage": 30,
"applyImmediately": false,
"autoMinorVersionUpgrade": true,
"copyTagsToSnapshot": false,
"deleteAutomatedBackups": true,
"engine": "postgres",
"identifier": "postgresdb8a8a6f1",
"instanceClass": "db.t4g.micro",
"monitoringInterval": 0,
"dbName": "airflow",
"password": "tuFp574p9Arw58gu",
"performanceInsightsEnabled": false,
"publiclyAccessible": false,
"skipFinalSnapshot": true,
"username": "airflow"
},
"oldInputs": {
"__defaults": [
"applyImmediately",
"autoMinorVersionUpgrade",
"copyTagsToSnapshot",
"deleteAutomatedBackups",
"identifier",
"monitoringInterval",
"performanceInsightsEnabled",
"publiclyAccessible"
],
"allocatedStorage": 30,
"applyImmediately": false,
"autoMinorVersionUpgrade": true,
"copyTagsToSnapshot": false,
"deleteAutomatedBackups": true,
"engine": "postgres",
"identifier": "postgresdb8a8a6f1",
"instanceClass": "db.t4g.micro",
"monitoringInterval": 0,
"name": "airflow",
"password": "tuFp574p9Arw58gu",
"performanceInsightsEnabled": false,
"publiclyAccessible": false,
"skipFinalSnapshot": true,
"username": "airflow"
}
},
"response": {
"stables": "*",
"changes": "DIFF_NONE",
"hasDetailedDiff": true
},
"metadata": {
"kind": "resource",
"mode": "client",
"name": "aws"
}
}
]`)
}
Loading

0 comments on commit f158e81

Please sign in to comment.