Skip to content
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

Acceptance Testing Returning JSON Plan Difference After Apply (regression between v2.0.3 and HEAD) #604

Closed
bflad opened this issue Oct 3, 2020 · 2 comments · Fixed by #605
Labels
bug Something isn't working

Comments

@bflad
Copy link
Contributor

bflad commented Oct 3, 2020

SDK version

Current HEAD (post v2.0.3, pre v2.0.4):

github.com/hashicorp/terraform-plugin-sdk/v2@951f045a9f1406210062af4371b9a7be6e158edb

Relevant provider source code

Can provide if needed.

Terraform Configuration Files

Can provide if needed.

Debug Output

Can provide if needed.

Expected Behavior

v2.0.1 showed the human readable plan difference on refresh after apply issues:

=== CONT  TestAccAWSDmsReplicationTask_basic
TestAccAWSDmsReplicationTask_basic: resource_aws_dms_replication_task_test.go:18: After applying this test step, the plan was not empty.
stdout:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_dms_replication_task.dms_replication_task will be updated in-place
~ resource "aws_dms_replication_task" "dms_replication_task" {
id                        = "tf-test-dms-replication-task-e2hd26cy"
migration_type            = "full-load"
replication_instance_arn  = "arn:aws:dms:us-west-2:*******:rep:IJ7XT3Q6SEKNGQV7JC7PDGBQGFJIWMFJHISA4KY"
replication_task_arn      = "arn:aws:dms:us-west-2:*******:task:3P2GAUOSQJUKISSPPWRVOVS6NWW5333VZZTMXLI"
replication_task_id       = "tf-test-dms-replication-task-e2hd26cy"
~ replication_task_settings = jsonencode(
~ {
- BeforeImageSettings               = null -> null

Actual Behavior

=== CONT  TestAccAWSDmsReplicationTask_basic
TestAccAWSDmsReplicationTask_basic: resource_aws_dms_replication_task_test.go:18: Step 1/3 error: After applying this test step, the plan was not empty.
stdout:
{"format_version":"0.1","terraform_version":"0.12.29","planned_values":{"root_module":{"resources":[{"address":"aws_dms_endpoint.dms_endpoint_source","mode":"managed","type":"aws_dms_endpoint","name":"dms_endpoint_source","provider_name":"aws","schema_version":0,"values":{"certificate_arn":"","database_name":"tf-test-dms-db","elasticsearch_settings":[],"endpoint_arn":"arn:aws:dms:us-west-2:*******:endpoint:JIH35DGCIVAHLVA4L3H7S2QJKNIMW5K2X7LDSAY","endpoint_id":"tf-test-dms-endpoint-source-0qkeppvm","endpoint_type":"source","engine_name":"aurora","extra_connection_attributes":"","id":"tf-test-dms-endpoint-source-0qkeppvm","kafka_settings":[],"kinesis_settings":[],"kms_key_arn":"arn:aws:kms:us-west-2:*******:key/f5709827-76e0-4544-b2ec-9d09d1138bb1","mongodb_settings":[],"password":"tftest","port":3306,"s3_settings":[],"server_name":"tf-test-cluster.cluster-xxxxxxx.us-west-2.rds.amazonaws.com","service_access_role":null,"ssl_mode":"none","tags":null,"username":"tftest"}},{"address":"aws_dms_endpoint.dms_endpoint_target","mode":"managed","type":"aws_dms_endpoint","name":"dms_endpoint_target","provider_name":"aws","schema_version":0,"values":{"certificate_arn":"","database_name":"tf-test-dms-db","elasticsearch_settings":[],"endpoint_arn":"arn:...........

Steps to Reproduce

  1. TF_ACC=1 go test -run=TestAccAWSDmsReplicationTask_basic -v

References

#578

https://github.com/hashicorp/terraform-plugin-test/blob/025e2cb31d4123a77fcb60455bca889d31fa4239/working_dir.go#L320-L339

// SavedPlanStdout returns a stdout capture of the current saved plan file, if any.
//
// If no plan is saved or if the plan file cannot be read, SavedPlanStdout returns
// an error.
func (wd *WorkingDir) SavedPlanStdout() (string, error) {
if !wd.HasSavedPlan() {
return "", fmt.Errorf("there is no current saved plan")
}
var ret bytes.Buffer
wd.tf.SetStdout(&ret)
defer wd.tf.SetStdout(ioutil.Discard)
_, err := wd.tf.ShowPlanFile(context.Background(), wd.planFilename(), tfexec.Reattach(wd.reattachInfo))
if err != nil {
return "", err
}
return ret.String(), nil
}

@bflad bflad added the bug Something isn't working label Oct 3, 2020
bflad added a commit to bflad/terraform-plugin-sdk that referenced this issue Oct 3, 2020
Reference: hashicorp#578
Reference: hashicorp#604

Restores v2.0.3 behavior and renames the function slightly for additional clarity on its intent.

Previously with consistently failing provider check:

```
=== CONT  TestAccAWSDmsReplicationTask_basic
TestAccAWSDmsReplicationTask_basic: resource_aws_dms_replication_task_test.go:18: Step 1/3 error: After applying this test step, the plan was not empty.
stdout:
{"format_version":"0.1","terraform_version":"0.12.29","planned_values":{"root_module":{"resources":[{"address":"aws_dms_endpoint.dms_endpoint_source","mode":"managed","type":"aws_dms_endpoint","name":"dms_endpoint_source","provider_name":"aws","schema_version":0,"values":{"certificate_arn":"","database_name":"tf-test-dms-db","elasticsearch_settings":[],"endpoint_arn":"arn:aws:dms:us-west-2:*******:endpoint:JIH35DGCIVAHLVA4L3H7S2QJKNIMW5K2X7LDSAY","endpoint_id":"tf-test-dms-endpoint-source-0qkeppvm","endpoint_type":"source","engine_name":"aurora","extra_connection_attributes":"","id":"tf-test-dms-endpoint-source-0qkeppvm","kafka_settings":[],"kinesis_settings":[],"kms_key_arn":"arn:aws:kms:us-west-2:*******:key/f5709827-76e0-4544-b2ec-9d09d1138bb1","mongodb_settings":[],"password":"tftest","port":3306,"s3_settings":[],"server_name":"tf-test-cluster.cluster-xxxxxxx.us-west-2.rds.amazonaws.com","service_access_role":null,"ssl_mode":"none","tags":null,"username":"tftest"}},{"address":"aws_dms_endpoint.dms_endpoint_target","mode":"managed","type":"aws_dms_endpoint","name":"dms_endpoint_target","provider_name":"aws","schema_version":0,"values":{"certificate_arn":"","database_name":"tf-test-dms-db","elasticsearch_settings":[],"endpoint_arn":"arn:...........
```

Now with local Go Module replace directive:

```
=== CONT  TestAccAWSDmsReplicationTask_basic
    resource_aws_dms_replication_task_test.go:18: Step 1/3 error: After applying this test step, the plan was not empty.
        stdout:

        An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
          ~ update in-place

        Terraform will perform the following actions:

          # aws_dms_replication_task.dms_replication_task will be updated in-place
          ~ resource "aws_dms_replication_task" "dms_replication_task" {
                id                        = "tf-test-dms-replication-task-qsk63z02"
                migration_type            = "full-load"
                replication_instance_arn  = "arn:aws:dms:us-west-2:--OMITTED--:rep:AZCTZFYYTBQUNMNFP3LDR3A5RAC44QTLT36UC4I"
                replication_task_arn      = "arn:aws:dms:us-west-2:--OMITTED--:task:YS3DREABEI2X4KW46QHESNSZIBOAZXU4WLIPH5I"
                replication_task_id       = "tf-test-dms-replication-task-qsk63z02"
              ~ replication_task_settings = jsonencode(
                  ~ {
```
@bflad
Copy link
Contributor Author

bflad commented Oct 3, 2020

Fix proposal: #605

@bflad bflad changed the title Acceptance Testing Returning JSON Plan Difference After Apply (regression between v2.0.1 and HEAD) Acceptance Testing Returning JSON Plan Difference After Apply (regression between v2.0.3 and HEAD) Oct 3, 2020
paddycarver pushed a commit that referenced this issue Oct 6, 2020
Reference: #578
Reference: #604

Restores v2.0.3 behavior and renames the function slightly for additional clarity on its intent.

Previously with consistently failing provider check:

```
=== CONT  TestAccAWSDmsReplicationTask_basic
TestAccAWSDmsReplicationTask_basic: resource_aws_dms_replication_task_test.go:18: Step 1/3 error: After applying this test step, the plan was not empty.
stdout:
{"format_version":"0.1","terraform_version":"0.12.29","planned_values":{"root_module":{"resources":[{"address":"aws_dms_endpoint.dms_endpoint_source","mode":"managed","type":"aws_dms_endpoint","name":"dms_endpoint_source","provider_name":"aws","schema_version":0,"values":{"certificate_arn":"","database_name":"tf-test-dms-db","elasticsearch_settings":[],"endpoint_arn":"arn:aws:dms:us-west-2:*******:endpoint:JIH35DGCIVAHLVA4L3H7S2QJKNIMW5K2X7LDSAY","endpoint_id":"tf-test-dms-endpoint-source-0qkeppvm","endpoint_type":"source","engine_name":"aurora","extra_connection_attributes":"","id":"tf-test-dms-endpoint-source-0qkeppvm","kafka_settings":[],"kinesis_settings":[],"kms_key_arn":"arn:aws:kms:us-west-2:*******:key/f5709827-76e0-4544-b2ec-9d09d1138bb1","mongodb_settings":[],"password":"tftest","port":3306,"s3_settings":[],"server_name":"tf-test-cluster.cluster-xxxxxxx.us-west-2.rds.amazonaws.com","service_access_role":null,"ssl_mode":"none","tags":null,"username":"tftest"}},{"address":"aws_dms_endpoint.dms_endpoint_target","mode":"managed","type":"aws_dms_endpoint","name":"dms_endpoint_target","provider_name":"aws","schema_version":0,"values":{"certificate_arn":"","database_name":"tf-test-dms-db","elasticsearch_settings":[],"endpoint_arn":"arn:...........
```

Now with local Go Module replace directive:

```
=== CONT  TestAccAWSDmsReplicationTask_basic
    resource_aws_dms_replication_task_test.go:18: Step 1/3 error: After applying this test step, the plan was not empty.
        stdout:

        An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
          ~ update in-place

        Terraform will perform the following actions:

          # aws_dms_replication_task.dms_replication_task will be updated in-place
          ~ resource "aws_dms_replication_task" "dms_replication_task" {
                id                        = "tf-test-dms-replication-task-qsk63z02"
                migration_type            = "full-load"
                replication_instance_arn  = "arn:aws:dms:us-west-2:--OMITTED--:rep:AZCTZFYYTBQUNMNFP3LDR3A5RAC44QTLT36UC4I"
                replication_task_arn      = "arn:aws:dms:us-west-2:--OMITTED--:task:YS3DREABEI2X4KW46QHESNSZIBOAZXU4WLIPH5I"
                replication_task_id       = "tf-test-dms-replication-task-qsk63z02"
              ~ replication_task_settings = jsonencode(
                  ~ {
```
@ghost
Copy link

ghost commented Nov 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant