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

data.aws_mq_broker results in error "logs: logs.0.audit: '' expected type 'bool', got unconvertible type 'string'" #19494

Closed
davidcallen opened this issue May 24, 2021 · 5 comments · Fixed by #19502
Assignees
Labels
bug Addresses a defect in current functionality. service/mq Issues and PRs that pertain to the mq service.
Milestone

Comments

@davidcallen
Copy link

I am trying to upgrade terraform 0.14.8 ->0.15.4 and terraform-aws-provider 3.32.0 ->3.42.0.

This has been ok in numerous accounts until I do it on an account that has AmazonMQ (ActiveMQ)

I encountered this error :


Error: error setting logs: logs.0.audit: '' expected type 'bool', got unconvertible type 'string'

│   with data.aws_mq_broker.amazon-mq-01,
│   on amazon-mq-02.tf line 12, in data "aws_mq_broker" "amazon-mq-01":
│   12: data "aws_mq_broker" "amazon-mq-01" {

The line in question is :

data "aws_mq_broker" "amazon-mq-01" {
  broker_id = "b-f19ff297-ebe4-4593-935f-ee1d3036115a"
}

I stayed on terraform 0.15.4 but down-graded back to 3.32.0. All OK now.
I upgrade to 3.37.0 and all OK.
I upgrade from 3.37.0 to 3.37.0 and I get the error :

Error: error setting logs: logs.0.audit: '' expected type 'bool', got unconvertible type 'string'

I'd suspect something to

$ terraform -v
Terraform v0.15.4
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v3.38.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/tls v3.1.0

This is run from Fedora Linux 33

$ uname -a
Linux laptop.foobar.com 5.11.21-200.fc33.x86_64 #1 SMP Sat May 15 20:31:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

There are a few mentions in the release notes for 3.38.0 relating to new RabittMQ support. Maybe this has caused a regression ?

Panic Output

none

Expected Behavior

The upgrade and terraform apply should complete without error

Actual Behavior

Error : 
Error: error setting logs: logs.0.audit: '' expected type 'bool', got unconvertible type 'string'
│   with data.aws_mq_broker.amazon-mq-01,
│   on amazon-mq-02.tf line 12, in data "aws_mq_broker" "amazon-mq-01":
│   12: data "aws_mq_broker" "amazon-mq-01" {

Steps to Reproduce

In 3.37.0 create an AmazonMQ like this :


resource "aws_mq_broker" "amazon-mq" {
    apply_immediately          = true
    authentication_strategy    = "simple"
    auto_minor_version_upgrade = true
    broker_name                = "amazon-mq-01"
    deployment_mode            = "SINGLE_INSTANCE"
    engine_type                = "ActiveMQ"
    engine_version             = "5.15.15"
    host_instance_type         = "mq.t3.micro"
    publicly_accessible        = false
    security_groups            = [
        "sg-.....",
    ]
    storage_type               = "efs"
    subnet_ids                 = [
        "subnet-.......",
    ]
    tags                       = {
        "Environment"     = "staging"
    }
    configuration {
        id       = aws_mq_configuration.amazon-mq.id
        revision = aws_mq_configuration.amazon-mq.latest_revision
    }
    encryption_options {
        use_aws_owned_key = true
    }
    logs {
        audit   = true
        general = true
    }
    maintenance_window_start_time {
        day_of_week = "SUNDAY"
        time_of_day = "02:00"
        time_zone   = "UTC"
    }
    user {
        console_access = false
        groups         = []
        password       = (sensitive value)
        username       = "MQ_APP"
    }
    user {
        console_access = true
        groups         = [
            "admin",
        ]
        password       = (sensitive value)
        username       = "MQ_ADMIN"
    }
}
resource "aws_mq_configuration" "amazon-mq" {
    authentication_strategy = "simple"
    data                    = <<-EOT
		....
    EOT
    description             = "..."
    engine_type             = "ActiveMQ"
    engine_version          = "5.15.15"
    latest_revision         = 2
    name                    = "amazon-mq-01"
    tags                    = {}
}
data "aws_mq_broker" "amazon-mq-01" {
  broker_id = aws_mq_broker.amazon-mq.id
}

Note: above taken from a "terraform show state" and sensitve info redacted so is not exact replica of my terraform.

Then terraform apply - all should be OK

Then upgrade to 3.38.0 with

terraform init -upgrade

Then "terraform apply" and should get error :

Error: error setting logs: logs.0.audit: '' expected type 'bool', got unconvertible type 'string'

Important Factoids

none

References

Maybe relates to changes in release notes for 3.38.0 :

#19066
#19142

  • #0000
@ghost ghost added the service/mq Issues and PRs that pertain to the mq service. label May 24, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 24, 2021
@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label May 24, 2021
@ewbankkit

This comment has been minimized.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label May 24, 2021
@ewbankkit
Copy link
Contributor

@davidcallen Thanks for raising this issue 👏.
You are correct that it is the difference between TypeBool and TypeString (for the nullable-bool) that is causing this.
I will submit a PR to address this.

@ewbankkit
Copy link
Contributor

We have a failing CI test related to this bug:

Test ended in panic.
------- Stdout: -------
=== RUN   TestAccDataSourceAWSMqBroker_basic
=== PAUSE TestAccDataSourceAWSMqBroker_basic
=== CONT  TestAccDataSourceAWSMqBroker_basic
------- Stderr: -------
panic: logs.0.audit: '' expected type 'bool', got unconvertible type 'string'
goroutine 2316 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc003995580, 0x8239658, 0x4, 0x6a3a2c0, 0xc000594b70, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource_data.go:230 +0x371
github.com/terraform-providers/terraform-provider-aws/aws.dataSourceAwsmQBrokerRead(0xc003995580, 0x7427e20, 0xc003258000, 0xd0eb8f0, 0xc003eee400)
  /opt/teamcity-agent/work/2e10e023da0c7520/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_mq_broker.go:341 +0xc51
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0013127e0, 0x92f07e8, 0xc002d68500, 0xc003995580, 0x7427e20, 0xc003258000, 0x0, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource.go:335 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc0013127e0, 0x92f07e8, 0xc002d68500, 0xc002e416e0, 0x7427e20, 0xc003258000, 0xc003258000, 0xc002e416e0, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource.go:558 +0xfd
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc002124078, 0x92f07e8, 0xc002d68500, 0xc002e413e0, 0xc002d68500, 0x40dba5, 0x7d5de80)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/grpc_provider.go:1105 +0x4d6
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadDataSource(0xc0024c0ee0, 0x92f0890, 0xc002d68500, 0xc00007f090, 0xc0024c0ee0, 0xc00057a720, 0xc002ccbba0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.3.0/tfprotov5/server/server.go:247 +0xe5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler(0x8030880, 0xc0024c0ee0, 0x92f0890, 0xc00057a720, 0xc002e22840, 0x0, 0x92f0890, 0xc00057a720, 0xc0014aeb60, 0x191)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.3.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:416 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc001aa6380, 0x931a7b8, 0xc002049200, 0xc00456de00, 0xc003ca6f60, 0xd088b70, 0x0, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc001aa6380, 0x931a7b8, 0xc002049200, 0xc00456de00, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0019920f0, 0xc001aa6380, 0x931a7b8, 0xc002049200, 0xc00456de00)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:857 +0x1fd

@ghost
Copy link

ghost commented Jun 1, 2021

This has been released in version 3.43.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@github-actions
Copy link

github-actions bot commented Jul 2, 2021

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/mq Issues and PRs that pertain to the mq service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants