Keep tags when ensure group
@@ -7,10 +7,17 @@ import (
// EnsureResourceGroup ensures the named resouce group exists in the given location.
func (az *AzureClient) EnsureResourceGroup(name, location string, managedBy *string) (resourceGroup *resources.Group, err error) {
+ var tags *map[string]*string
+ group, err := az.groupsClient.Get(name)
+ if err == nil {
+ tags = group.Tags
+ }
+
response, err := az.groupsClient.CreateOrUpdate(name, resources.Group{
Name: &name,
Location: &location,
ManagedBy: managedBy,
+ Tags: tags,
})
if err != nil {
return &response, err
