https://pulumi.com logo
#getting-started
Title
# getting-started
s

sparse-state-54552

11/14/2022, 3:15 PM
Good morning. I am trying to create some GCP uptime checks with Pulumi but on every apply it wants to replace them despite despite no actual difference. I've split the code into a class in Python to be able to loop over it to create multiple instances. the code as follows.
Copy code
from pulumi_gcp import monitoring

class GCPUptimeCheck:

    def __init__(self, hostname, projectid):
        self.hostname = f"{hostname}.<http://verifybrand.com|verifybrand.com>"
        self.projectid = projectid  

    def createUptimeCheck(self):
        project_id = self.projectid
        https = monitoring.UptimeCheckConfig(f"{self.hostname}-UptimeCheck",
            display_name=self.hostname,
            http_check=monitoring.UptimeCheckConfigHttpCheckArgs(
                path="/home/heartbeat",
                port=443,
                use_ssl=True,
                validate_ssl=True
            ),
            monitored_resource=monitoring.UptimeCheckConfigMonitoredResourceArgs(
                labels={
                    "host":self.hostname,
                    "projectId":project_id,
                },
                type="uptime_url",
            ),
                timeout="10s",
                project=self.projectid
        )
        return https
On each apply it says the reason to replace is because of the monitoredResource. Runnin a preview --json I have the following detailed reasons.
Copy code
"detailedDiff": {
                "monitoredResource.labels.projectId": {
                    "kind": "add-replace",
                    "inputDiff": false
                },
                "monitoredResource.labels.project_id": {
                    "kind": "delete-replace",
                    "inputDiff": false
                }
            }
But looking at the old state and new state it lists the same json output. I's like to not to replace the uptime checks to be able to keep historical data. Any help is appreciated.
b

billowy-army-68599

11/14/2022, 4:01 PM
can you open an issue if you can repro?
4 Views