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

[New Resource] - azurerm_postgresql_flexible_server_virtual_endpoint #26708

Merged
merged 53 commits into from
Aug 9, 2024

Conversation

bruceharrison1984
Copy link
Contributor

@bruceharrison1984 bruceharrison1984 commented Jul 19, 2024

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

This adds support to Flexible Postgres Servers for creating Virtual Endpoints.

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #25803

@bruceharrison1984 bruceharrison1984 changed the title 25803 [New Resource] - azurerm_postgresql_flexible_server_virtual_endpoint Jul 19, 2024
bruceharrison1984 and others added 2 commits August 1, 2024 09:21
…endpoint_resource_test.go


use standard error message

Co-authored-by: stephybun <[email protected]>
…endpoint_resource.go


use standard pointer conversion

Co-authored-by: stephybun <[email protected]>
bruceharrison1984 and others added 4 commits August 1, 2024 09:23
…endpoint_resource_test.go


use more explicit pointer conversion on return type

Co-authored-by: stephybun <[email protected]>
…endpoint_resource.go


Use consistent styling

Co-authored-by: stephybun <[email protected]>
…endpoint_resource_test.go


remove unnecessary test conditions

Co-authored-by: stephybun <[email protected]>

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.update(data, "azurerm_postgresql_flexible_server.test_replica_0.id"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to be as explicit as possible in the test configurations and don't pass updated ID values in as arguments to the config. This also fails at the moment:

------- Stdout: -------
=== RUN   TestAccPostgresqlFlexibleServerVirtualEndpoint_update
=== PAUSE TestAccPostgresqlFlexibleServerVirtualEndpoint_update
=== CONT  TestAccPostgresqlFlexibleServerVirtualEndpoint_update
    testcase.go:121: Step 1/4 error: Error running pre-apply plan: exit status 1
        Error: length should be equal to or less than 63, got "acctest-psql-virtualendpoint-primary-240807125523377850-replica-0"
          with azurerm_postgresql_flexible_server.test_replica_0,
          on terraform_plugin_test.tf line 51, in resource "azurerm_postgresql_flexible_server" "test_replica_0":
          51:   name                          = "${azurerm_postgresql_flexible_server.test.name}-replica-0"
--- FAIL: TestAccPostgresqlFlexibleServerVirtualEndpoint_update (15.02s)
FAIL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting, it was passing locally. Easy enough to shorten the name though.

Would you recommend passing in the full virtual endpoint resources rather than just the ID? Can you point me towards something more in line with what you're looking for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'll be able to find an example quickly for this specific case, but typically update tests will take advantage of an already existing basic or complete config, so the acceptance test would like:

func TestAccPostgresqlFlexibleServerVirtualEndpoint_update(t *testing.T) {
	data := acceptance.BuildTestData(t, "azurerm_postgresql_flexible_server_virtual_endpoint", "test")
	r := PostgresqlFlexibleServerVirtualEndpointResource{}

	data.ResourceTest(t, r, []acceptance.TestStep{
		{
			Config: r.basic(data),
			Check: acceptance.ComposeTestCheckFunc(
				check.That(data.ResourceName).ExistsInAzure(r),
			),
		},
		data.ImportStep(),
		{
			Config: r.update(data),
			Check: acceptance.ComposeTestCheckFunc(
				check.That(data.ResourceName).ExistsInAzure(r),
			),
		},
		data.ImportStep(),
	})
}

But on second though it's probably sufficient to just shorten the name to prevent the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decreased the length of resource names, and the tests all passed on the TC server

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bruceharrison1984 LGTM 👍

@stephybun stephybun merged commit 4af1907 into hashicorp:main Aug 9, 2024
35 checks passed
@github-actions github-actions bot added this to the v3.116.0 milestone Aug 9, 2024
@bruceharrison1984 bruceharrison1984 deleted the 25803 branch August 9, 2024 14:03
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, 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 Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for virtual endpoints for Postgres Flexible Servers
2 participants