Skip to content

Adapt API changes to TGW HA config#2006

Merged
ksamoray merged 1 commit intovmware:masterfrom
ksamoray:tgw_ha
Mar 18, 2026
Merged

Adapt API changes to TGW HA config#2006
ksamoray merged 1 commit intovmware:masterfrom
ksamoray:tgw_ha

Conversation

@ksamoray
Copy link
Copy Markdown
Contributor

@ksamoray ksamoray commented Mar 11, 2026

Transit gateway high_availability_config attribute has been replaced with centralized_config child object with a separate API.

@ksamoray ksamoray force-pushed the tgw_ha branch 2 times, most recently from b92bf23 to ff04637 Compare March 11, 2026 08:47
@ksamoray
Copy link
Copy Markdown
Contributor Author

/test-all

@poojav25
Copy link
Copy Markdown
Contributor

LGTM

@ksamoray
Copy link
Copy Markdown
Contributor Author

/test-all

@ksamoray
Copy link
Copy Markdown
Contributor Author

/test-all

Copy link
Copy Markdown
Contributor

@aruntony005 aruntony005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


log.Printf("[INFO] Creating TransitGateway with ID %s", id)
// Attach centralized_config as H-API child in same transaction
if cc := getCentralizedConfigFromSchema(d.Get("centralized_config")); cc != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should cc == nil be an error?

If not we will end up adding an object without children to the H-API made below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc == nil is not an error - a user can create a TGW without centralized config.

tgw.Id = &tgwID
childTGW := model.ChildTransitGateway{
Id: &tgwID,
ResourceType: model.ChildTransitGateway__TYPE_IDENTIFIER,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the right SDK attribute for the resource_type?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so - it's a child under org->project etc. It's similar to what we have in resource_nsxt_policy_predefined_security_policy.go.

d.Set("span", span)
}

// Read centralized config via H-API
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following does not seem to be using h-api.

if cfg.HaMode != nil {
m["ha_mode"] = *cfg.HaMode
} else {
m["ha_mode"] = model.CentralizedConfig_HA_MODE_ACTIVE
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you believe this is the right thing to do?
From what I gathered it should not lead to a permadiff, but maybe the thing is that we will never find haMode to be nil

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't do this, and this attribute has a default anyway...

}
m["edge_cluster_paths"] = cfg.EdgeClusterPaths
if m["edge_cluster_paths"] == nil {
m["edge_cluster_paths"] = []string{}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not sure about this one.
An empty list is not the same thing as not specified.

}

// createChildOrgWithTransitGatewayMarkedForDelete builds the H-API tree for delete: Org -> Project -> TransitGateway with MarkedForDelete.
func createChildOrgWithTransitGatewayMarkedForDelete(orgID, projectID, tgwID string) (*data.StructValue, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you-know-who created another function which is exactly the same as createChildOrgWithTransitGateway with the exception of the value used for MarkedForDelete.

Is there are a good reason for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged these two

Transit gateway high_availability_config attribute has been replaced with centralized_config
chile object with a separate API.

Signed-off-by: Kobi Samoray <kobi.samoray@broadcom.com>
@ksamoray
Copy link
Copy Markdown
Contributor Author

/test-all

Copy link
Copy Markdown
Member

@salv-orlando salv-orlando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ksamoray ksamoray merged commit e76cf32 into vmware:master Mar 18, 2026
11 checks passed
@ksamoray ksamoray deleted the tgw_ha branch March 18, 2026 14:10
ksamoray added a commit that referenced this pull request Mar 18, 2026
Transit gateway high_availability_config attribute has been replaced with centralized_config
chile object with a separate API.

Signed-off-by: Kobi Samoray <kobi.samoray@broadcom.com>
ksamoray added a commit that referenced this pull request Mar 21, 2026
Transit gateway high_availability_config attribute has been replaced with centralized_config
chile object with a separate API.

Signed-off-by: Kobi Samoray <kobi.samoray@broadcom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants