Skip to content

Commit

Permalink
Merge pull request #126 from volcengine/feat/cr
Browse files Browse the repository at this point in the history
Feat/cr
  • Loading branch information
zpp12354321 authored Sep 6, 2023
2 parents 2454d3b + 43a53fa commit 8c79787
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common/common_volcengine_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package common

const (
TerraformProviderName = "terraform-provider-volcengine"
TerraformProviderVersion = "0.0.107"
TerraformProviderVersion = "0.0.108"
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
Import
CR Instance can be imported using the name, e.g.
```
$ terraform import volcengine_cr_instance.default enterprise-x
$ terraform import volcengine_cr_registry.default enterprise-x
```
*/
Expand Down
21 changes: 21 additions & 0 deletions volcengine/cr/cr_registry/service_volcengine_cr_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func (s *VolcengineCrRegistryService) RefreshResourceState(resourceData *schema.
var (
demo map[string]interface{}
status interface{}
userStatus interface{}
failStates []string
)
failStates = append(failStates, "Failed")
Expand All @@ -186,6 +187,18 @@ func (s *VolcengineCrRegistryService) RefreshResourceState(resourceData *schema.
return nil, "", fmt.Errorf("CrRegistry status error,status %s", status.(string))
}
}

//must wait user status
if len(target) > 0 && target[0] == "Active" {
userStatus, err = ve.ObtainSdkValue("UserStatus", demo)
if userStatus != "Active" {
status = "InActive"
} else {
if status == "Running" {
status = userStatus
}
}
}
return demo, status.(string), err
},
}
Expand Down Expand Up @@ -241,6 +254,10 @@ func (s *VolcengineCrRegistryService) CreateResource(resourceData *schema.Resour
logger.Debug(logger.ReqFormat, call.Action, call.SdkParam)
return s.Client.UniversalClient.DoCall(getUniversalInfo(call.Action), call.SdkParam)
},
Refresh: &ve.StateRefresh{
Target: []string{"Active"},
Timeout: resourceData.Timeout(schema.TimeoutCreate),
},
},
}
callbacks = append(callbacks, callback)
Expand All @@ -266,6 +283,10 @@ func (s *VolcengineCrRegistryService) ModifyResource(resourceData *schema.Resour
logger.Debug(logger.ReqFormat, call.Action, call.SdkParam)
return s.Client.UniversalClient.DoCall(getUniversalInfo(call.Action), call.SdkParam)
},
Refresh: &ve.StateRefresh{
Target: []string{"Active"},
Timeout: resourceData.Timeout(schema.TimeoutUpdate),
},
},
}
callbacks = append(callbacks, callback)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ func ResourceVolcengineSecurityGroup() *schema.Resource {
Description: "Name of SecurityGroup.",
},
"project_name": {
Type: schema.TypeString,
Optional: true,
//ForceNew: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "The ProjectName of SecurityGroup.",
},
"tags": ve.TagsSchema(),
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/cr_registry.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ In addition to all arguments above, the following attributes are exported:
## Import
CR Instance can be imported using the name, e.g.
```
$ terraform import volcengine_cr_instance.default enterprise-x
$ terraform import volcengine_cr_registry.default enterprise-x
```

0 comments on commit 8c79787

Please sign in to comment.