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

Google DNS A Records are not overwritten #624

Closed
Arturx47 opened this issue Jul 20, 2021 · 14 comments
Closed

Google DNS A Records are not overwritten #624

Arturx47 opened this issue Jul 20, 2021 · 14 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@Arturx47
Copy link

Arturx47 commented Jul 20, 2021

The google Dns records are not overwritten using pulumi_gcp in pulumi 3.X

Steps to reproduce

We got a problem with the pulumi_gcp, the existing DNS records are not overwritten anymore,
pulumi fails with resource is existing…in python
It was working on pulumi 2.6(i think its not working from 2.8) anyways its not working anymore in 3.3.1(last one tested, but i was also having the issue in 3.6 i think) … i need to make sure to delete all the existing records sets before…so it does not exit with 1

we use exactly the same code as the documentation and it was working....

class RecordSet(pulumi.CustomResource):
def init(self,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
managed_zone: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
rrdatas: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
ttl: Optional[pulumi.Input[int]] = None,
type: Optional[pulumi.Input[str]] = None,
props=None,
name=None,
opts=None):

1.Install pulumi 3.3.1
2.create a dns record with ip x of type A
3.create a stack in pulumi and put that stack, to create the dns record with a different ip address

Expected:
Update the the ip address of an existing dns record...
Actual:
Error creating ResourceDnsRecordSet: googleapi: Error 409: The resource 'entity.rrset' named 'test.test2.com. (A)' already exists, alreadyExists

@Arturx47 Arturx47 added the kind/bug Some behavior is incorrect or out of spec label Jul 20, 2021
@leezen leezen added the impact/regression Something that used to work, but is now broken label Jul 20, 2021
@leezen
Copy link
Contributor

leezen commented Jul 20, 2021

Could you please indicate which version of the pulumi-gcp provider you're using?

@Arturx47
Copy link
Author

Arturx47 commented Jul 21, 2021

sure its pulumi-gcp-5.8.1

@Arturx47
Copy link
Author

Arturx47 commented Jul 21, 2021

pulumi_gcp 4.5.2 with pulumi 2.25.2 is still working after my last test done now and it will update the records sets if they exists, il try to figure out the version now where the bug is first time seen, probably from pulumi_gcp 5*

Update:

i did some more testing...
it fails from the last version of 4 with pulumi_gcp 4.21.0

  • Error creating ResourceDnsRecordSet: googleapi: Error 409: The resource 'entity.rrset' named 'test-test.domain.eu. (A)' already exists, alreadyExists

@Sytten
Copy link

Sytten commented Aug 2, 2021

Yeah I have a similar issue, basically it tries to do a replace when modifying the RRDATAS which fails because you cant have two records with the same name.
This is really annoying

@leezen
Copy link
Contributor

leezen commented Aug 2, 2021

@Arturx47 @Sytten I'm a bit confused now re-reading what you've posted. Are you saying that you have "Stack A" which has a RecordSet with a certain name and you're trying to have "Stack B" overwrite that name with a different RecordSet?

@Sytten
Copy link

Sytten commented Aug 2, 2021

In my case it is the same stack, just try to create and then modify a rrset, you will see it does a replace instead of an update. But might be a fault upstream in the terraform provider.

@Arturx47
Copy link
Author

Arturx47 commented Aug 4, 2021

in my case yes, i use a stack A create the dns record sets and if we delete the cluster we also delete the stack, if we create again the cluster than a new stack B would try to overright the dns recordsets with the ip of the new cluster...which should work and did work...
(> Note: The provider treats this resource as an authoritative record set. This means existing records (including
the default records) for the given type will be overwritten when you create this resource in the provider.)

@leezen
Copy link
Contributor

leezen commented Aug 4, 2021

@Arturx47 Interesting. When you perform the pulumi destroy of Stack A, does it show the RRSet as deleting?

Here's what I attempted to reproduce what both @Sytten and @Arturx47 are describing above:

  1. Create a DNS record.
  2. Attempt to delete the record. This fails since we attempt to do a replace and Pulumi attempts to create before delete. You can fix this via specifying the deleteBeforeReplace option.
  3. Separately, the fact that it's not updating and simply replacing is an upstream issue (see Updating google_dns_record_set forces replacement of the resource instead of in-place update hashicorp/terraform-provider-google#9614)
  4. Attempt to delete the stack. Succeeds
  5. Attempt to create the stack again. Also succeeds. So I'm a bit baffled by what @Arturx47 is describing since the record set does get cleaned up properly. @Arturx47 do you have a more detailed repro?

I'll leave this issue to track the upstream bug around replace vs. update.

@leezen leezen added the awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). label Aug 4, 2021
@Arturx47
Copy link
Author

Arturx47 commented Aug 5, 2021

Hello, i did not use pulumi destroy i did just delete the stack, as we hold it...now i was saying that if the dns record exists before the stack, than when you create the stack and put pulumi to update it it will fail and will not do a replace.
Stepts to reproduce:

  1. create manually a dns A record with ip x
  2. create a pulumi stack
  3. put the stack to create the same A record from step 1 but with a different ip.

As from my understanding if the dns record exists beforehand of the stack, that is meaning not created by the stack or created by other stack, as the resource is an authoritative record set, when i created a stack and the stack finds an A record lets say record A with ip 192.168.1.1 and it has a different ip for it lets say 192.168.1.2 in the past it would simply replace it...now its complaining that record set it is already existing.

@leezen
Copy link
Contributor

leezen commented Aug 5, 2021

If the record already exists beforehand, then Pulumi will have no knowledge of that record. What you will want to do in that case is import the record so that it can be managed as part of your stack (see https://www.pulumi.com/docs/guides/adopting/import/) before modifying it.

@Arturx47
Copy link
Author

Arturx47 commented Aug 6, 2021

Thank you, i know about importing but this was working well as described in pulumi 2, and its not working now anymore...moreover in the description from the code it says...

." > Note: The provider treats this resource as an authoritative record set. This means existing records (including
the default records) for the given type will be overwritten when you create this resource in the provider."

This means that exactly this should happen even if they are existing beforehand.

@leezen
Copy link
Contributor

leezen commented Aug 6, 2021

@Arturx47 The latest version of the provider doesn't have that note in the documentation. Are you picking that up from the previous version? I believe the resource behavior has changed upstream given the change in hashicorp/terraform-provider-google#8835

@Arturx47
Copy link
Author

hello, from pulumi-gcp 4.5.2 so you are saying that this will no longer be supported?

@mikhailshilkov mikhailshilkov added the resolution/fixed This issue was fixed label Jan 30, 2023
@mikhailshilkov
Copy link
Member

The upstream issue with replace-vs-update has been fixed a long time ago in GoogleCloudPlatform/magic-modules#5191

According to #624 (comment) I'll go ahead and close the issue as done. Please open a new issue if things aren't working as folks expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

4 participants