Skip to content

Commit

Permalink
fix(fgs/dependency): ignore the field setting for link param
Browse files Browse the repository at this point in the history
  • Loading branch information
Lance52259 committed Aug 14, 2024
1 parent 0f054cf commit e241dd7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
18 changes: 18 additions & 0 deletions docs/resources/fgs_dependency_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,21 @@ Or using related dependency package `name` and the `version` number, separated b
```bash
$ terraform import huaweicloud_fgs_dependency_version.test <name>/<version>
```

Note that the imported state may not be identical to your resource definition, due to some attributes missing from the
API response, security or some other reason. The missing attributes include: `link`.
It is generally recommended running `terraform plan` after importing a dependency package.
You can then decide if changes should be applied to the resource, or the resource definition should be updated to
align with the dependency package. Also you can ignore changes as below.

```hcl
resource "huaweicloud_fgs_dependency_version" "test" {
...
lifecycle {
ignore_changes = [
link,
]
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,29 @@ func TestAccDependencyVersion_basic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"link",
},
},
// Test the ID format: <depend_name>/<version>
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateIdFunc: testAccDependencyVersionImportStateFunc_withDependName(resourceName),
ImportStateVerifyIgnore: []string{
"link",
},
},
// Test the ID format: <depend_name>/<version_id>
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateIdFunc: testAccDependencyVersionImportStateFunc_withVersionId(resourceName),
ImportStateVerifyIgnore: []string{
"link",
},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,14 @@ func resourceDependencyVersionRead(_ context.Context, d *schema.ResourceData, me
return common.CheckDeletedDiag(d, err, "FunctionGraph dependency version")
}

// FunctionGraph will store the compressed package content pointed to by the link into the storage bucket provided
// by FunctionGraph and return a new link.
// If the ReadContext is set this value according to the query result, ForceNew behavior will be triggered the next
// time it is applied.
mErr := multierror.Append(
d.Set("runtime", resp.Runtime),
d.Set("name", resp.Name),
d.Set("description", resp.Description),
d.Set("link", resp.Link),
d.Set("etag", resp.Etag),
d.Set("size", resp.Size),
d.Set("owner", resp.Owner),
Expand Down

0 comments on commit e241dd7

Please sign in to comment.