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

Attempting to change description field in awscc_iotsitewise_asset_model resource throws AWS SDK Go Service Operation Incomplete error #1967

Open
gagan1469 opened this issue Aug 22, 2024 · 6 comments
Assignees
Labels
bug service/iotsitewise upstream-aws Unable to proceed due to missing or broken functionality from an AWS dependency.

Comments

@gagan1469
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Terraform CLI and Terraform AWS Cloud Control Provider Version

  • Terraform v1.6.2
  • Installed hashicorp/awscc v1.7.0 (signed by HashiCorp)

Affected Resource(s)

  • awscc_iotsitewise_asset_model
  • The behaviour is also seen in awscc_iotsitewise_asset

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

The behaviour is worse in awscc_iotsitewise_asset where the drift detection makes it want to mangle the asset configuration. (Will submit a separate issue for it.)

Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

resource "awscc_iotsitewise_asset_model" "vdc" {
    asset_model_name = "vdc"
    asset_model_description = "Wireless Voltage Sensors for Field Testing"
    asset_model_type = "ASSET_MODEL"
    asset_model_properties = [ 
        {
            name = "id"
            data_type = "STRING"
            logical_id = "id"
            type = {
                type_name = "Attribute"
                attribute = {
                    default_value = "enter value here"
                }
            } 
        },
        {
            name = "voltage"
            data_type = "DOUBLE"
            logical_id = "voltage"
            type = {
                type_name = "Measurement"
            }
            unit = "mV" 
        },
        {
            name = "battery_level"
            data_type = "DOUBLE"
            logical_id = "battery_level"
            type = {
                type_name = "Measurement"
            }
            unit = "V" 
        }
    ]
    tags = var.tags
}

variable "tags" {
    description = "AWS resource tags for AWSCC provider"
    type = set(object({
      key = string
      value = string
    }))
}

Note: tags are read in from a yaml file. The tags are:

tags                    = [
            {
                key   = "addedDate"
                value = "2024-08-20T00:00:00Z"
            },
            {
                key   = "solution"
                value = "field solution"
            },
          + {
              + key   = "addedBy"
              + value = "Automation Terraform AzDO"
            },
          + {
              + key   = "environment"
              + value = "dev"
            },
        ]

Debug Output

Panic Output

Expected Behavior

Terraform plan detects that the asset_model_description has changed from "Wireless Voltage Sensors" to "Wireless Voltage Sensors for Field Testing", and should make the change. The change should be visible in the console.

Actual Behavior

Terraform apply returns error and the job fails to run to completion. The error message is:

module.iot_sitewise.awscc_iotsitewise_asset_model.vdc: Modifying... [id=b3c53c89-7e42-44ce-8b7c-28e0d81ca5c0]
╷
│ Error: AWS SDK Go Service Operation Incomplete
│ 
│   with module.iot_sitewise.awscc_iotsitewise_asset_model.vdc,
│   on iot_sitewise/main.tf line 11, in resource "awscc_iotsitewise_asset_model" "vdc":
│   11: resource "awscc_iotsitewise_asset_model" "vdc" {
│ 
│ Waiting for Cloud Control API service UpdateResource operation completion
│ returned: waiter state transitioned to FAILED. StatusMessage: Invalid
│ request provided: The actual ID of a resource cannot be set. To uniquely
│ identify the property use ExternalId or LogicalId.. ErrorCode:
│ InvalidRequest
╵

The error was reproduced 3 different times.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

@quixoticmonk
Copy link
Collaborator

Thanks for opening the issue @gagan1469 . I can reproduce this both on the Terraform configuration and via cloud control api. Opening an internal service ticket to review this.

@quixoticmonk quixoticmonk self-assigned this Aug 22, 2024
@quixoticmonk quixoticmonk added upstream-aws Unable to proceed due to missing or broken functionality from an AWS dependency. service/iotsitewise and removed needs-triage labels Aug 22, 2024
@gagan1469
Copy link
Author

Thanks for opening the issue @gagan1469 . I can reproduce this both on the Terraform configuration and via cloud control api. Opening an internal service ticket to review this.

Thank you @quixoticmonk. This touches other attributes and possibly all. I could not edit tags (after I reordered them to correctly identify drift). I think you can reproduce it for changing a model property (using simple alphabetical names you used in #1965).

And you should also see this issue in the editing of an awscc_iotsitewise_asset resource as well.

@gagan1469
Copy link
Author

@quixoticmonk I setup a simple asset model with a single asset model property to avoid the sequencing issue reported in #1965. Also, created an asset using the simple asset model. The code is included below, if you want to use in your testing. Making a single change, and running terraform apply, I can confirm that changing the following attributes in awscc_iotsitewise_asset resource result in the "AWS SDK Go Service Operation Incomplete" error:

  • asset_description
  • asset_properties[0].alias
  • asset_properties[0].unit

Did you want to open a separate issue for awscc_iotsitewise_asset?
Resource code follows:

# temporary - simple model with one property to test awscc bug
resource "awscc_iotsitewise_asset_model" "iot-pressure" {
    asset_model_name = "iot-pressure"
    asset_model_description = "Single property asset model for awscc update testing"
    asset_model_type = "ASSET_MODEL"
    asset_model_properties = [ 
        {
            name = "pressure"
            data_type = "DOUBLE"
            logical_id = "pressure"
            type = {
                type_name = "Measurement"
            } 
            unit = "psi"
        }
    ]

    tags = var.tags

    # not using asset_model_composite_models and asset_model_hierarchies 
    # but add them to the ignore changes list
    lifecycle {
      ignore_changes = [tags, 
                        asset_model_composite_models, 
                        asset_model_hierarchies
                        ]
    }
}

resource "awscc_iotsitewise_asset" "hou-pressure" {
    asset_model_id = awscc_iotsitewise_asset_model.iot-pressure.id
    asset_name = "hou-pressure"
    asset_description = "Single property asset for awscc update testing"
    asset_properties = [ 
        {
            alias = "/iot/houston/pressure"
            notification_state = "DISABLED"
            logical_id = "pressure"
            unit = "psi"
        }
    ]
    tags = var.tags

    lifecycle {
      ignore_changes = [tags,
                        asset_hierarchies
                        ]
    }

}

@quixoticmonk
Copy link
Collaborator

Thanks @gagan1469 . I can include the reference of awscc_iotsitewise_asset into the same ticket specifying the issue exists there as well.

@gagan1469
Copy link
Author

Hi @quixoticmonk, would you be able to provide an update on this issue? Do you know when we can expect an update in the cloud control api / updated awscc provider? Out of curiosity, does this issue exist in CloudFormation as well?

@quixoticmonk
Copy link
Collaborator

The ticket is still being reviewed for the changes required from the handlers which review the Id being used in update operations. I haven't had a chance to test this with CloudFormation yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug service/iotsitewise upstream-aws Unable to proceed due to missing or broken functionality from an AWS dependency.
Projects
None yet
Development

No branches or pull requests

2 participants