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

awscc_groundstation_dataflow_endpoint_group can't maintain endpoint_details list order because UPDATE action is not supported #2036

Open
htrs2 opened this issue Sep 26, 2024 · 1 comment

Comments

@htrs2
Copy link

htrs2 commented Sep 26, 2024

Terraform version

terraform: v1.9.6
terraform-provider-awscc version: 1.15.0

Affected Resource

awscc_groundstation_dataflow_endpoint_group

Description

After creating awscc_groundstation_dataflow_endpoint_group with multiple endpoints in the endpoint_details list, when "terraform plan" is run after the initial creation, the list order changed.

Since awscc_groundstation_dataflow_endpoint_group doesn't support UPDATE action, terraform apply will fail

Terraform code

resource "awscc_groundstation_dataflow_endpoint_group" "this" {
  endpoint_details = [{
    endpoint = {
      name = "test01-DownlinkEndpoint"
      address = {
        name = "10.1.1.1"
        port = "55888"
      }
    }
    security_details = {
      role_arn = "arn:aws:iam::xxxxxxxxxxx"
      security_group_ids = [
        "sg-xxxxxxxxxxx"
      ]
      subnet_ids = [
        "subnet-xxxxxxxxxxxxxx"
      ]
    }
    },
    {
      endpoint = {
        name = "test01-UplinkEndpoint"
        address = {
          name = "10.1.1.1"
          port = "55889"
        }
      }
      security_details = {
        role_arn = "arn:aws:iam::xxxxxxxxxxx"
        security_group_ids = [
          "sg-xxxxxxxxxxx"
        ]
        subnet_ids = [
          "subnet-xxxxxxxxxxxxxx"
        ]
      }
    },
    {
      endpoint = {
        name = "test01-UplinkEchoEndpoint"
        address = {
          name = "10.1.1.1"
          port = "55890"
        }
      }
      security_details = {
        role_arn = "arn:aws:iam::xxxxxxxxxxx"
        security_group_ids = [
          "sg-xxxxxxxxxxx"
        ]
        subnet_ids = [
          "subnet-xxxxxxxxxxxxxx"
        ]
      }
    }
  ]
}

Expected Behavior

when run terraform plan after the initial deployment, no change is expected

Actual Behavior


Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # awscc_groundstation_dataflow_endpoint_group.this will be updated in-place
  ~ resource "awscc_groundstation_dataflow_endpoint_group" "this" {
      ~ endpoint_details                   = [
          ~ {
              + aws_ground_station_agent_endpoint = (known after apply)
              ~ endpoint                          = {
                  ~ address = {
                        name = "10.1.1.1"
                      ~ port = 55889 -> 55888
                    }
                  + mtu     = (known after apply)
                  ~ name    = "test01-UplinkEndpoint" -> "test01-DownlinkEndpoint"
                }
                # (1 unchanged attribute hidden)
            },
          ~ {
              + aws_ground_station_agent_endpoint = (known after apply)
              ~ endpoint                          = {
                  ~ address = {
                        name = "10.1.1.1"
                      ~ port = 55890 -> 55889
                    }
                  + mtu     = (known after apply)
                  ~ name    = "test01-UplinkEchoEndpoint" -> "test01-UplinkEndpoint"
                }
                # (1 unchanged attribute hidden)
            },
          ~ {
              + aws_ground_station_agent_endpoint = (known after apply)
              ~ endpoint                          = {
                  ~ address = {
                        name = "10.1.1.1"
                      ~ port = 55888 -> 55890
                    }
                  + mtu     = (known after apply)
                  ~ name    = "test01-DownlinkEndpoint" -> "test01-UplinkEchoEndpoint"
                }
                # (1 unchanged attribute hidden)
            },
        ]
        id                                 = "xxxxxxxxxxxxxxxxxxxxxxxxx"
      + tags                               = (known after apply)
        # (4 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
awscc_groundstation_dataflow_endpoint_group.this: Modifying... [id=xxxxxxxxxxxxxxxxxxxx]
╷
│ Error: AWS SDK Go Service Operation Unsuccessful
│
│   with awscc_groundstation_dataflow_endpoint_group.this,
│   on awscc_groundstation_dataflow_endpoint_group.tf line 1, in resource "awscc_groundstation_dataflow_endpoint_group" "this":
│    1: resource "awscc_groundstation_dataflow_endpoint_group" "this" {
│
│ Calling Cloud Control API service UpdateResource operation returned: operation error CloudControl: UpdateResource, https response error StatusCode: 400, RequestID:
│ xxxxxxxxxxxxxxxxxxxxxx, UnsupportedActionException: Resource type AWS::GroundStation::DataflowEndpointGroup does not support UPDATE action

Steps to reproduce

  1. run terraform apply
  2. after successful apply, run terraform plan
@quixoticmonk
Copy link
Collaborator

Thank you for opening the issue @htrs2 . I do not have an easy way to reproduce this. But could you try the list of endpoints with a toset() function to see if that addresses the ordering ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants