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

Fixed target_resource_details of oci_bastion_session having unexpected diff after creation #1705

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tumugin
Copy link

@tumugin tumugin commented Nov 6, 2022

This PR will fix issue, target_resource_details of oci_bastion_session having unexpected diff after creation.

The fix

The polymorphic type of oci_bastion.TargetResourceDetails which was specified in type assertions was wrong so I fixed to the correct one.

Step to reproduce this issue

The following terraform resources will cause this issue.

After creating this resources, oci_bastion_session will always run into forces replacement because of the unexpected diff of target_resource_details.

resource "oci_bastion_bastion" "private_bastion" {
  bastion_type                 = "STANDARD"
  compartment_id               = var.compartment_id
  target_subnet_id             = oci_core_subnet.vcn_private_subnet.id
  client_cidr_block_allow_list = ["0.0.0.0/0"]
}

resource "oci_bastion_session" "private_mysql_session" {
  bastion_id = oci_bastion_bastion.private_bastion.id
  key_details {
    public_key_content = "<YOUR_PUBLIC_KEY_HERE>"
  }
  target_resource_details {
    session_type                               = "PORT_FORWARDING"
    target_resource_private_ip_address         = oci_mysql_mysql_db_system.mysql_db_system.ip_address
    target_resource_port                       = 3306
  }

  display_name           = "private_mysql_session"
  key_type               = "PUB"
  session_ttl_in_seconds = "10800"
}

The output of terraform plan is following.

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # module.kino.oci_bastion_session.kino_private_mysql_session[0] must be replaced
-/+ resource "oci_bastion_session" "kino_private_mysql_session" {
      ~ bastion_name                 = "bastion20221105195433" -> (known after apply)
      + bastion_public_host_key_info = (known after apply)
      ~ bastion_user_name            = "*************" -> (known after apply)
      ~ id                           = "*************" -> (known after apply)
      + lifecycle_details            = (known after apply)
      ~ ssh_metadata                 = {
          - "command" = "ssh -i <privateKey> -N -L <localPort>:10.0.1.218:3306 -p 22 *************"
        } -> (known after apply)
      ~ state                        = "ACTIVE" -> (known after apply)
      ~ time_created                 = "2022-11-06 10:14:05.865 +0000 UTC" -> (known after apply)
      ~ time_updated                 = "2022-11-06 10:14:12.867 +0000 UTC" -> (known after apply)
        # (4 unchanged attributes hidden)

      + target_resource_details { # forces replacement
          + session_type                               = "PORT_FORWARDING" # forces replacement
          + target_resource_display_name               = (known after apply)
          + target_resource_fqdn                       = (known after apply)
          + target_resource_id                         = (known after apply)
          + target_resource_operating_system_user_name = (known after apply)
          + target_resource_port                       = 3306 # forces replacement
          + target_resource_private_ip_address         = "10.0.1.218" # forces replacement
        }

        # (1 unchanged block hidden)
    }

Plan: 1 to add, 0 to change, 1 to destroy.

@oracle-contributor-agreement
Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Nov 6, 2022
@tumugin
Copy link
Author

tumugin commented Nov 6, 2022

Sorry, my agreements is under review.

@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Nov 8, 2022
@tumugin
Copy link
Author

tumugin commented Nov 22, 2022

@jotruon Could you review this PR and merge it if there is no problem?

@jotruon jotruon requested a review from ravinitp November 23, 2022 01:27
@jotruon
Copy link
Member

jotruon commented Nov 23, 2022

sure, I forward your PR to service team to review and test

@tumugin
Copy link
Author

tumugin commented Dec 3, 2022

@ravinitp Could you review this PR?

@nom3ad
Copy link

nom3ad commented Feb 25, 2023

image

After trying to upgrade to v4.109.0, TF plan shows above diff even after applying all changes.

Looks like this regression was introduced in v4.96.0. I had to pin provider to "4.95.0" for now.

Hope this PR will be merged soon.

@ravinitp ravinitp added the Pending Test Pending Test label for PRs label Jul 4, 2023
@ravinitp
Copy link
Member

ravinitp commented Jul 4, 2023

Thank you for your valuable contribution. We greatly appreciate your efforts in submitting this pull request. However, I regret to inform you that we are unable to merge it directly on GitHub at this time.

Our internal policy requires that all pull requests undergo thorough local testing and review before they can be merged into the main codebase. This process ensures the quality and stability of Terraform-Provider-OCI.

We understand that this may cause some inconvenience, but please rest assured that your contribution is highly valued. Our team will carefully review and test your changes locally to ensure they meet our standards.

We appreciate your understanding and patience in this matter. If you have any questions or need further assistance, please don't hesitate to reach out. Thank you once again for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement. Pending Test Pending Test label for PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants