-
Notifications
You must be signed in to change notification settings - Fork 2
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
Unable to update existing service #480
Comments
From a Fastly perspective using terraform to control an existing service you need to import the service first so that TF will have a state, it will try to create a new one with out provider. The import function is there for that reason to build the current state first. This might be the reason and maby it's easier to create a new service with Pulumi? You could just remove/change the hostname of the existing service and create a new one using Pulumi. I haven't worked with Pulumi nor do I have the abilities to do PR's to this code but advising from my knowledge of TF and Fastly. |
@NisseBoman You're right in that the import feature should be used in Pulumi AFAIK. Using the Pulumi Automation API this would mean something similar to: err := stack.Import(context, state) Now I just need to figure out where (and how) the state is fetched from the Fastly plugin. On the Pulumi CLI it would be something similar to: pulumi import fastly:index:ServiceVcl "My CDN service" Although I'm not a Terraform user, so there's a small gap that needs to be bridged in my understanding. |
Adding this link for visibility: https://registry.terraform.io/providers/fastly/fastly/latest/docs/resources/service_compute#import |
I resolves this. Thanks to the Terraform tip @NisseBoman. I want to provide the approach for future use cases. When trying this approach I did receive an error that changes did not correlate, and I tried using I removed that and tried again, (with a correction to the shield as there was a typo), and it worked. One thing to note, the result, err := fastly.NewServiceVcl(pulumiContext, "edge-network-delivery", &fastly.ServiceVclArgs{
Activate: pulumi.Bool(false),
Backends: &fastly.ServiceVclBackendArray{
&fastly.ServiceVclBackendArgs{
Address: pulumi.String("***-some-web-address.dev***"),
AutoLoadbalance: pulumi.Bool(false),
BetweenBytesTimeout: pulumi.Int(10000),
ConnectTimeout: pulumi.Int(1000),
ErrorThreshold: pulumi.Int(0),
FirstByteTimeout: pulumi.Int(15000),
Name: pulumi.String("Home Site"),
OverrideHost: pulumi.String("***-some-web-address.dev***"),
Shield: pulumi.String("hel-helsinki-fi"),
SslCertHostname: pulumi.String("*.custom-hostname.dev"),
},
},
Domains: &fastly.ServiceVclDomainArray{
&fastly.ServiceVclDomainArgs{
Name: pulumi.String("my-domain.site"),
},
},
Reuse: pulumi.Bool(true),
Name: pulumi.String("My CDN service"),
}, pulumi.Import(pulumi.ID("54BLTxJYhXx7qnuR5UKcuLt8Hb3n2")) |
When using the Fastly APIs directly it's possible to update an existing service, previously created through the dashboard.
Currently I'm unable to achieve the same with Pulumi.
I'm running a refresh, and then up command (with the Automation API) with the following:
I've played with the
Reuse
and force delete options, and I'm half expecting that deleting the original handmade service is necessary.The typical flow I am hoping to achieve with this package is to create a new version of a configuration, then apply it. However, there's no version settings that I can see here, and I'm getting the following response when applying the above configuration:
Any guidance on the expected behavior and how to achieve a similar flow is appreciated.
The text was updated successfully, but these errors were encountered: